Saturday, 5 April 2014

SharePoint 2010: User Profiles properties not updated in People Editor and My Settings

SharePoint 2010: User Profiles properties not updated in People Editor and My Settings
Initially I have a set of users in the user profiles with only some set of Properties mapped. I have not set properties like Department, Email and Mobile number. My People Editor is showing empty values for Department, Email, Mobile Number and Title.

Now I set back the values in the user profiles as shown below
I have saved the above user profiles properties. Now when I check back in People Editor, this values are not reflected.
Resolution:
This user profiles properties are not reflected to the site collection. Each site collection has the user info list which will store the details locally in each site collection. To Sync the details two timer jobs need to be run.
1. Profile Synchronization – Default to run every hour
2. Quick Profile Synchronization- Default to run every minute
Using STSATM command we can initiate and force the timer job to run.
First run the Profile Synchronization timer job.
Ø Stsadm –o Sync –SyncTiming M:5
Now call the second timer
Ø Stsadm –o Sync -sweeptiming M:5
In some cases if the above does not update run the below stsadm command
Ø Stsadm –o sync –listdatabases <n> and
Ø Stsadm –o sync –deletedatabases<n>
-here n refers the days. While doing the Sync this database will be created. Delete databases command will delete old databases and recreate the full sync database. This delete would affect or delete your content database.

Hide/Show SPRibbon in SP2010 / 2013 based on User Permission by using SharePoint Designer in

1. Just call the Jquery file in master page header section like below.

<script type="text/javascript"
  src="/Style%20Library/jquery-1.6.1.min.js"></script>

  2. We need to remove the welcome menu control from
 < SharePoint:DelegateControl >


     
  3. Add this below DIV controls after SPRibbon DIV tag closed.

  <div class="s4-trc-container-menu1" style="text-align:right;float:right;width:100%; position:absolute;margin-top:10px;">
 <div id="notificationArea1" class="s4-noti" style="right: 16px;
  top: 0px; height: 22px">
<wssuc:Welcome id="IdWelcome1" runat="server"
EnableViewState="false"></wssuc:Welcome>
<wssuc:MUISelector ID="IdMuiSelector1" runat="server"/>
</div>
</div>

  4. Then finally Add below script before body tag closed.

       <script type="text/javascript">
     var UserHasPermissions = false;
                </script>

<Sharepoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl1" runat="server" PermissionsString="ManageWeb">
   <script type="text/javascript">
       UserHasPermissions = true;
  </script>
  </SharePoint:SPSecurityTrimmedControl>

<script type="text/javascript">
       if (UserHasPermissions) {
           document.getElementById("s4-trc-container-menu1").style.display = "none";
       }
       else {
           document.write('<scr' + 'ipt type="text/javascript" src="/Style Library/RemoveWelcomeMenuOption.js"></scr' + 'ipt>');

           if (getQueryVariable("IsDlg") != "undefined")
               if (getQueryVariable("IsDlg") == "1") {
                   document.getElementById("s4-ribboncont").style.display = "inline";
               }
               else {
                   document.getElementById("s4-ribboncont").style.display = "none";
                   document.getElementById("s4-trc-container-menu1").style.display = "block";
               }

           function getQueryVariable(varname) {
               var query = window.location.search.substring(1);
               var vars = query.split("&");
               for (var i = 0; i < vars.length; i++) {
                   var pair = vars[i].split("=");
                   if (pair[0] == varname) {
                       return pair[1];
                   }
               }
           }

       }
               


   //RemoveWelcomeMenuOption.js

jQuery(document).ready(function($){
  $("[text='My Settings']").remove();
  $("[text='Personalize this Page']").remove();
});
</script>


Required Js file :jquery-1.6.1.min.js