Saturday 21 September 2013

How to disable Edit My Profile button from SharePoint My Site template

Problem Description:

In SharePoint My Site template "Edit My Profile" option is present.
If user click on that link,then they can change their details,which get reflected into Active Directory.
So our on of the client doesn't want to give permission to user to change their profile data.

When i see URL, thoughts.aspx page is present in _layouts folder.



Resolution:

Step 1: Open SharePoint layouts folder.

            (How to access layout folder)

Step 2: Open 
thoughts.aspx file in notepad.

Step 3 : As shown in below image hide div tag.


Step 4: Open  thoughts.aspx in IE.


Product applies to:

·     SharePoint Server 2010

·     SharePoint Foundation 2010


How to access layout folder in SharePoint

Problem Description:

Where is the _layouts directory on the server?

Resolution:

Sharepoint 2010 layouts folder:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\

If you're using SP 2007 the folder is

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\


Product applies to:

·     SharePoint Server 2010

·     SharePoint Foundation 2010

Could not load the Web.config configuration file. Check the file for any malformed XML elements, and try again. The following error occurred: The given key was not present in the dictionary.

Problem Description:

I tried to debug SharePoint project in Visual Studio 2010. I found error where deploying project/solution is fine, but debugging doesn’t work. I saw an error alert with the text:
“Could not load the Web.config configuration file. Check the file for any malformed XML elements, and try again. The following error occurred: The given key was not present in the dictionary.”



The Web.config doesn’t have any error. One thing to check into is the configuration of alternate access mappings in Central Administration.
For debugging to work, the Site URL property of our SharePoint project must match the URL of the Default zone for your web application.

Resolution:

Step 1: Go to Central Administration

Step 2: System Setting

Step 3: Configure alternate access mappings

Step 4: Edit public URLs



Step 4: Set Default URL same as Visual Studio
(In this case make it as http://SiteName:20103)





Product applies to:

·     SharePoint Server 2010
·     SharePoint Foundation 2010


Saturday 31 August 2013

SharePoint Designer - Cannot perform this operation. The file is no longer check out or has been deleted


Problem Description:
The css file showed itself as being checked out when it was actually checked in.

Error Message:

SharePoint Designer - Cannot perform this operation. The file is no longer check out or has been deleted 



Resolution:

The problem is to delete your temporary internet files and to clear your website cache of all files. (Search WebsiteCache into My Computer) After this, everything will work again.

Product applies to:

·                     SharePoint Server 2010
·                     SharePoint Foundation 2010



Feel free to revert in-case of any query...

Thursday 4 July 2013

SharePoint master page css styles not showing for users other than site administrator.


Today I face one tricky problem in SharePoint 2010.
When I login through site administrator then CSS which I apply on master page work fine,
But when I login through other users CSS effects are not visible on master page.


Error Message:

SharePoint master page css styles not showing for users other than site administrator.


Problem Description:

        This usually happens when the CSS file or master page is not published or approved yet or it may be Check-In.

  •  After system administrator login, Menu Bar from Master page look like this.





  •  After normal user login, Menu Bar from Master page look like this.
  •  Here CSS is not apply.



Resolution:

To Approve Master page Follow below steps:

1.             Open the SharePoint Designer using System Administrator Account.



2.             From Site Object select Master Page

3.             Select your default Master page. (E.g. V4.master)

4.             On “Site Page Gallery”, see “View” section and that click on “Approve/reject. Items” view.



5.             You will see the view is “Group By” by “Approval Status. (E.g. Draft, Approved) 
        Basically Approval Status is divided into 4 different status like Draft, Pending, Approved,Reject


6.             Then Search your default Master page in Draft section select it and send for Approval.




7.             Refresh your page, your default Master page will shown in Pending status section, Select and Approve it.




8.             Finally default master page get approved by System Administrator,
          means it get publish for all user on site.




Product Applies To:         SharePoint Server 2010
Feel free to revert in-case of any query... 

Monday 1 July 2013

Hide SharePoint list column from form using designer.

Problem Description: 

Hide SharePoint list column from form using designer. 
Resolution:
Step 1:- Select column from design view. Eg. PickupDateTime
Step 2:- Search attribute class of “<td>” tag as “ms-formlabel” and “ms-formbody” for Label and control respectively.


Step 3:- And Change that class name as “ms-hidden” for both Label as well as Control.


Product Applies To:
 
·         SharePoint Server 2010 
·         SharePoint Foundation 2010 
·         SharePoint Server 2013
 
Feel free to revert in-case of any query...
 


Friday 21 June 2013

Create and Read cookie in SharePoint 2010.

Problem Description:

Create and Read cookie in SharePoint 2010.
Resolution:

<script type="text/javascript">

/* Create Cookie Function*/
    createCookie("CookieVarLocation",VarLocation);
/* Read Cookie Function*/
    var x =readCookie("CookieVarLocation");
   function createCookie(name,value)
   {
     var expires = "";
     document.cookie = name+"="+value+expires+"; path=/";
   }
   function readCookie(name)
  {      
    var nameEQ = name + "=";
     var ca = document.cookie.split(';');
     for(var i=0;i < ca.length;i++)
     {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
       return null;
    }
</script>
Feel free to revert in-case of any query...
Product Applies To:
·         SharePoint Server 2010
·         SharePoint Foundation 2010
·         SharePoint Server 2013

Fetch current login user data from active directory using JavaScript in SharePoint

Problem Description:

Fetch current login user data from active directory using JavaScript in SharePoint.

Resolution:

<script type="text/javascript">
/* getUserName function is use to find Current System User */
function getUserName()
{
 var wshNetwork = new ActiveXObject("WScript.Network");
 var userName = wshNetwork.UserName;
 return userName;
}

function getAD(userName)
{
 //var name = userName.split(".");
 objConnection = new ActiveXObject("ADODB.Connection");
 objConnection.Provider="ADsDSOObject";

 objConnection.Open("ADs Provider");

 objCommand = new ActiveXObject("ADODB.Command");
 objCommand.ActiveConnection = objConnection;

 objCommand.CommandText = "SELECT sAMAccountName, givenName, SN, mail,physicalDeliveryOfficeName FROM 'LDAP://DomainName.com/DC=Domain,DC=com' WHERE objectCategory='user' and sAMAccountName = '"+userName+"'";

 /* Next up is the command itself.*/
 objRecordSet = objCommand.Execute();

 /* Then we execute the command */
 /* Once executed, the command will return an enumeration of the results.*/

 var userMail,lastName,firstName;
 if (objRecordSet.RecordCount == 1) {
  objRecordSet.Movefirst;
  userMail = objRecordSet.Fields("mail").value;
  firstName = objRecordSet.Fields("givenName").value;
  lastName = objRecordSet.Fields("sn").value;
  samaccountname= objRecordSet.Fields("samaccountname").value;
  physicalDeliveryOfficeName= objRecordSet.Fields("physicalDeliveryOfficeName").value;
 }
 else
 {
  userMail = "";
  firstName = "";
  lastName = "";
  physicalDeliveryOfficeName = "";
 }
 objConnection.Close;
 return userMail+";"+firstName+";"+lastName+";"+physicalDeliveryOfficeName;
}

var AD = getAD(getUserName()).split(";");

var mail = AD[0];
var firstName = AD[1];
var lastName = AD[2];
var Office = AD[3];
</script>


References:

1) In objCommand.CommandText make connection string properly.
2) In Select query use column name of active directory from which you want data.
Refer this link for column name: http://ebookbrowse.com/aducproperties-xls-d22488526



Product Applies To:
·         SharePoint Server 2010
·         SharePoint Foundation 2010
·         SharePoint Server 2013

Feel free to revert in-case of any query...

Saturday 15 June 2013

Anchor tag in calculated column of SharePoint 2010

Problem Description:

Anchor tag in calculated column of SharePoint 2010.


Resolution:

Syntax:

  • In formula section add Anchor tag in double quotes as shown below.
  • Write your redirection page path in "href" attribute.
  • Keep column type as Number.


Example:
="<a href=/Lists/RequestList/CustomerCancelForm.aspx?ID="&ID&">Cancel</a>"




Product Applies To:
·         SharePoint Server 2010
·         SharePoint Foundation 2010
·         SharePoint Server 2013

Tuesday 28 May 2013

Add JavaScript file in SharePoint master page

Problem Description:

How to add JavaScript file in SharePoint master page.

Resolution:


Follow below steps:
  • Open your site in designer.
  • Select Master pages option.



  • Select V4.master, right click on it and select "Edit File in Advance Mode" option.



  • In V4.master file search "<ShararePoint:Scriptlink" tag.
  • As shown in below figure add your JavaScript file.



Product applies to:

  • SharePoint Server 2010
  • SharePoint Foundation 2010
  • SharePoint Server 2013

Feel free to revert in-case of any query...