Thursday, June 14, 2012

Add Google search text box inside Sharepoint 2010 site

1. Go to Hive \Web Server Extensions\14\TEMPLATE\LAYOUTS\
2.. Create folder called Custom\goole.html
Copy the following code into Google.html

<html>
<form method="get" action="http://www.google.com/search" target='_blank'>


<div style="padding:4px; vertical-align:middle; ">
<table border="0" cellpadding="0" cellspacing="0" >
<tr><td valign="bottom" style=" height:75px; ">
<table cellpadding="0" cellspacing="0"><tr><td valign="middle" style="height:35px">
<input type="text"   name="q" size="25"
 maxlength="255" value="" />
</td><td>
<input type="image" value="Google Search" src="/_LAYOUTS/style/Images/Cute-Ball-Search-icon.png"/>
</td></tr></table>
</td>
</tr>
</table>
</div>


</form>
</html>


3.Add a Page Viewer web part add the following paths. /_layouts/Custom.google.html.

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.




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...