Monday, April 23, 2012

Upload Document into Document library using Quick Launch.

1.Go to "Site Actions"  "Site Settings".
2.Click on "Quick Launch" under "Look and Feel".
3.Click on "New Navigation Link"
3.Type the Following URL in "Type web Address"

        /sites/test/_layouts/Upload.aspx?List={26C77C31-DAC0-4F67-A296-3002C51A7814}&RootFolder=&Source=http:/serverurl/sites/test/Requestlib/Forms/Allitems.asp


we need to give the GUID of the document library. And Path of the SharePoint document library.
4.Click Ok.

Thursday, April 19, 2012

Automatically create a Moss 2007 Site Collection Backup

To create a batch file

1. Click Start, and then click Run. 
2. Type notepad, and then click OK.
3. In Notepad, type the following text:



@echo off
Echo ------------------------------------------------------------------
@SET STSADM="D:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM"
@SET MAINSITEURL="http://moss2007/sites/test"
@SET BACKUPFILENAME="E:\test\Backup\%date:~10,4%_%date:~4,2%_%date:~7,2%_backup.bak"
Echo Getting Site Lock
%STSADM% -o getsitelock -url %MAINSITEURL%


Echo Setting Site Lock to ReadOnly
%STSADM% -o setsitelock -url %MAINSITEURL% -lock readonly
Echo Backing up the top level site
%STSADM% -o backup -url %MAINSITEURL% -filename %BACKUPFILENAME% -overwrite
Echo Setting Site Lock to None
%STSADM% -o setsitelock -url %MAINSITEURL% -lock none
Echo ------------------------------------------------------------------




4. In Notepad, on the File menu, click Save As.
5. In the Save As box, select the folder where you want to keep your batch file. 
6. Using the ".bat" file name extension, type the name of the file in the File name box, for example, backup_batch.bat. 
7. In the Save as type box, click All files. 
8. Click Save.





Use Task Scheduler to run a batch file that backs up Office SharePoint Server 2007
To schedule a backup

1. Click Start, and then click Run. 

2. Type control, and then click OK.

3. Double-click Scheduled Tasks. 

4. Double-click Add Scheduled Task.

5. When the Scheduled Task Wizard appears, click Next.



6. Click Browse, and then browse to and select the batch file that you just created. (See IMAGE-1)




7. Click Open.

8. Type a name for your task, for example, backup_batch. (See IMAGE-2)



9. Select how often you want this task performed (for example, weekly), and then click Next.

10. Select a day and time that you want this task to begin, and then click Next.

11. Enter a name and password for a user, and then click Next. This task will run as if it were started by that user.

12. Click Finish. (See IMAGE-3)


Wednesday, February 15, 2012

Dynamically Change the CSS for MOSS 2007 Master Page.

1.Crate more than two CSS file with different color code.
2. Upload the css files into the any of the document library. In this put in "Shared Documents".
3.Created eight CSS file and upload in the "Shared Documents".
4.Go the sharepoint Designer 2007.
5.Open site collection.
6.Go the master page under the catalogs folder.
7.Copy the default.master and paste rename into "Custom.master".
8.In the Master page <head> section add the following javascript.


<script type="text/javascript" language="javascript">

function loadjscssfile(filename, filetype){
var randomnumber=Math.floor(Math.random()*8);
// alert(randomnumber);
MyNumbers=new Array
("Customtest_green.css","Customtest_red.css","Customtest_orange.css","Customtest_pink.css","Customtest_purple.css","Customtest_turquoise.css","Customtest_yellow.css","Customtest.css");
filename="http://192.168.1.201/sites/test/Shared%20Documents/"+MyNumbers[randomnumber].toString();
  if (filetype=="css"){ //if filename is an external CSS file
  var fileref=document.createElement("link")
  fileref.setAttribute("rel", "stylesheet")
  fileref.setAttribute("type", "text/css")
  fileref.setAttribute("href", filename)
 }
 if (typeof fileref!="undefined")
  document.getElementsByTagName("head")[0].appendChild(fileref)
}


loadjscssfile("http://192.168.1.201/sites/test/Shared%20Documents/Customtest_green.css", "css") ////dynamically load and add this .css file
</script>

9.Save and publish the master page.
10. Now while loading the page randomly took the css.


Wednesday, February 1, 2012

Expand and Collapse the SharePoint Web parts.

1. Click on the Edit page Under "Site Actions".
2.Add Content Editor Web part any Zone.
3.Click on the Web part. "Click here to add content"
4.Click On "Edit Html Source" on the Ribbon.
5.Add following code.


<script type="text/javascript">
// Add the Web Part Titles here to have them opened by default
var wpsToSkip = ['Search Documents','sandbox'];
 //Add multiple Web parts to skip the Collapse
//var wpsToSkip = ['Search Documents','Pending Documents','sandbox'];


function wpExpander() {
 var theTDs = document.getElementsByTagName("TD");
 for (var t=0;t<theTDs.length;t++) {
  var id = theTDs[t].id;
  if (id.match("WebPartTitleWPQ")) {
   id = id.substr(id.indexOf("WPQ"));
   var title = (theTDs[t].innerText || theTDs[t].textContent).replace(/[\n\r]/,'');
   var strImg = "<img style='margin:6px 5px 0px 2px;cursor:hand;float:left;' ";
   if (wpsToSkip.join().match(title)) {
    strImg += "onClick='showHide(\""+id+"\",this)' src='/_layouts/images/minus.gif'>";
   } else {
    strImg += "onClick='showHide(\""+id+"\",this)' src='/_layouts/images/plus.gif'>";
    document.getElementById("WebPart"+id).style.display = "none";
   }
   theTDs[t].innerHTML = strImg + theTDs[t].innerHTML;
  }
 }
}


function showHide(i,o) {
 var wp = document.getElementById("WebPart"+i);
 wp.style.display = (wp.style.display=="") ? "none" : "";
 o.src = (o.src.match(/plus.gif/)) ? "/_layouts/images/minus.gif" : "/_layouts/images/plus.gif";
}


_spBodyOnLoadFunctionNames.push("wpExpander()");
</script>


6.Make this Web part as Hidden.
7.Save and Close the web part.



Sunday, January 29, 2012

Add Bullet to SharePoint Quick Launch

Add the core.css classes in your Custom CSS.
Find the Following CSS and add below code.


.s4-ql ul.root ul{
list-style-type: square !important; (OR)
list-style:none inside url('/sites/cppolicy/Style%20Library/Images/img-icon-leftnav.png');
   list-style-position: outside !important;
     margin-left: 25px !important;
}

.s4-ql ul.root ul > li > a{
/* Display Bullet in Quick Launch*/
      display: inline-block !important;
     padding-bottom: 0px !important;
     padding-left: 0px !important;
     vertical-align:bottom !important;
}

Friday, January 20, 2012

SharePoint Top navigation links read from the External file.


Get data from external file for SharePoint Top Navigation:
1.      Open the Web.config file for the SharePoint web application with a text editor such as notepad.
2.      Take copy the web.config before modifying the file.
3.      Path of the web.config is “C:\inetpub\wwwroot\wss\VirtualDirectories\80\”
4.      Add the following code in the siteMap and providers  as a last row.
<siteMap defaultProvider="CurrentNavigation" enabled="true">
      <providers>
<add name="CustomNavigationProvider" siteMapFile="/_layouts/1033/styles/CustomNavigationProvider/CustomSiteMap.sitemap" type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

5.      Save the Web.config and close it.
6.      Create a SiteMap file named CustomSiteMap.sitemap and put it into a new folder with the name CustomNavigationProvider. Add this folder into following directory: \14\TEMPLATE\LAYOUTS\1033\STYLES\CustomNavigationProvider

<?xml version="1.0" encoding="utf-8" ?>
<siteMap>
 
  <siteMapNode title="" url="">
    <siteMapNode title="Home" url="/"/>
    <siteMapNode title="sitecollection1" url="/sites/sitecollection1"> </siteMapNode>
   
  <siteMapNode title="Functions">
                  <siteMapNode title="sitecollection2" url=" /sites/sitecollection1 "/>
                  <siteMapNode title=" sitecollection3" url=" /sites/sitecollection3"/>
                  <siteMapNode title="ISC" url="/sites/isc"/>
                  <siteMapNode title="IT" url="/sites/it"/>
  </siteMapNode>
 </siteMapNode>
</siteMap>

7.      Open the master page and search for the content placeholder with the id PlaceHolderHorizontalNav. Replace this placeholder with this code:

<SharePoint:AspMenu
      ID="TopNavigationMenuV4"
      Runat="server"
      EnableViewState="false"
      DataSourceID="topSiteMap"
      AccessKey="<%$Resources:wss,navigation_accesskey%>"
      UseSimpleRendering="true"
      UseSeparateCss="false"
      Orientation="Horizontal"
      StaticDisplayLevels="2"
      MaximumDynamicDisplayLevels="1"
      SkipLinkText=""
      CssClass="s4-tn"
      Visible="false"/>
    <SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate"><Template_Controls>
            <asp:SiteMapDataSource
              ShowStartingNode="False"
              SiteMapProvider="SPNavigationProvider"
              id="topSiteMap"
              runat="server"
              StartingNodeUrl="sid:1002"/>
        </Template_Controls></SharePoint:DelegateControl>
       
       
        <SharePoint:AspMenu
      ID="CustomXmlNavigationAspMenu"
      Runat="server"
      EnableViewState="false"
      DataSourceID="CustomNavigationSiteMapDataSource"
      AccessKey="<%$Resources:wss,navigation_accesskey%>"
      UseSimpleRendering="true"
      UseSeparateCss="false"
      Orientation="Horizontal"
      StaticDisplayLevels="1"
      MaximumDynamicDisplayLevels="3"
      SkipLinkText=""
      CssClass="s4-tn">
   
    </SharePoint:AspMenu>

    <!-- Second sitemap DS -->
    <SharePoint:DelegateControl runat="server" ControlId="CustomXmlMapProviderDelegateControl">
        <Template_Controls>    
            <asp:SiteMapDataSource
              ShowStartingNode="False"
              SiteMapProvider="CustomNavigationProvider"
              id="CustomNavigationSiteMapDataSource"
              runat="server" />
        </Template_Controls>
    </SharePoint:DelegateControl>

8.      Save the master page now the Top navigation read the external file. If you want add new link to the top navigation add it into the CustomSiteMap.sitemap.




Friday, December 16, 2011

Converting a Custom SharePoint 2010 Master Page into a Search Center Master Page


  1. Make a copy of v4.master (or whatever other custom master page you are working with) and give it a new name like v4_searchcenter.master.
  2. Edit the new master page and locate and remove the PlaceHolderTitleBreadcrumb. This will allow the pop-out breadcrumb to still function properly:
    <asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server">
    <SharePoint:ListSiteMapPath
    runat="server"
    SiteMapProviders="SPSiteMapProvider,SPContentMapProvider"
    RenderCurrentNodeAsLink="false"
    PathSeparator=""
    CssClass="s4-breadcrumb"
    NodeStyle-CssClass="s4-breadcrumbNode"
    CurrentNodeStyle-CssClass="s4-breadcrumbCurrentNode"
    RootNodeStyle-CssClass="s4-breadcrumbRootNode"
    NodeImageOffsetX=0
    NodeImageOffsetY=353
    NodeImageWidth=16
    NodeImageHeight=16
    NodeImageUrl="/_layouts/images/fgimg.png"
    RTLNodeImageOffsetX=0
    RTLNodeImageOffsetY=376
    RTLNodeImageWidth=16
    RTLNodeImageHeight=16
    RTLNodeImageUrl="/_layouts/images/fgimg.png"
    HideInteriorRootNodes="true"
    SkipLinkText="" />
    </asp:ContentPlaceHolder>
  3. Next, add the PlaceHolderTitleBreadcrumb back right before the PlaceHolderMain. This will allow the search center to inject the search box in a good location:
    <asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server"></asp:ContentPlaceHolder>
    <asp:ContentPlaceHolder id="PlaceHolderMain" runat="server"/>
  4. Move PlaceHolderPageTitleInTitleArea (and any supporting HTML) to a hidden panel because this placeholder isn’t used the same way in the search center:
    <asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server" />
    <asp:Panel visible="false" runat="server">
    <asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server" />
    </asp:Panel>
  5. For v4.master you will also want to remove ClusteredDirectionalSeparatorArrow and <h2></h2>. It won’t make sense to show these at the top now:
    <SharePoint:ClusteredDirectionalSeparatorArrow runat="server"/>
    <h2></h2>
  6. Next, several lines of CSS need to be added to make sure things look right for the search center. You can add them to the <head> section of the master page:
    <style type="text/css">
    /* remove left margin */
    .s4-ca {
    margin-left: 0px;
    }
    /* remove gray background at top (optional) */
    .srch-sb-results {
    background:transparent none repeat scroll 0 0;
    }
    /* clean up top padding on 1st search page */
    .srch-sb-main {
    padding-top: 20px;
    }
    /* remove centering on 1st search page (optional) */
    .srch-sb-results4 {
    margin: inherit;
    padding-left: 20px;
    }
    /* remove background color on 1st search page (useful for colored designs) */
    .ms-bodyareaframe {
    background-color: transparent;
    }
    /* ------------------------------------------ */
    /* -- CSS that may be req. to reset the search styling -- */
    /* ------------------------------------------ */
    /* fix height of area above search results */
    td.ms-titleareaframe, div.ms-titleareaframe, .ms-pagetitleareaframe {
    height: auto !important;
    }
    /* fix border color on search results */
    .ms-main .ms-ptabrx, .ms-main .ms-sctabrx, .ms-main .ms-ptabcn, .ms-main .ms-sctabcn {
    border-color: #eeeeee;
    }
    /* fix arrangement of body area on search results */
    .srch-sb-results {
    height: auto;
    }
    /* fix positioning of prefs and advanced link on results */
    .ms-sblink {
    display:block;
    }
    /* fix the color of the prefs and advanced link on results */
    .ms-sblink a:link, .ms-sblink a:visited, .ms-sblink a:hover {
    color:#0072BC;
    }
    </style>
    5. Save the new master page, and check in / publish as a major version and approve it. Apply this master page to only the search center, and apply it as site master page while leaving system master page set as v4.master.
UPDATE: Some commenters have pointed out that if you want to edit pages in the Search Center (and who doesn’t?) these changes result in a double ribbon scenario. I haven’t fully tested this fix, so I’d be curious to hear about the results, but it looks like this would fix it:
  1. Add <asp:ContentPlaceHolder id="PlaceHolderGlobalNavigation" runat="server"/> to the hidden panel.
  2. Remove <div id="s4-ribboncont">…</div> and ALL of its contents.
  3. Add in its place this line: <asp:ContentPlaceHolder ID="SPNavigation" runat="server"></asp:ContentPlaceHolder>.

screenshots of the final result:



Give Read Permission for SharePoint Add-in for Azure AD Send Mail to Office 365 Domain Group users.

Below are the Steps for Send Mail to Office 365 Domain Group or AD Group users from Provider Hosted ADD-IN. For this we needs to Give Permi...