Posts

Showing posts from 2016

SharePoint 2013: Get UserProfile Properties with REST API

1) Get all properties of current user: http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties 2) Get single property of current user: http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties/PictureUrl OR http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties?$select=PictureUrl 3) Get Multiple Properties for the current user: http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties?$select=PictureUrl,AccountName 4) Get all properties of Specific User: For Office 365/SharePoint Online: http://siteurl/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='user name' For SharePoint 2013 On-Premise: http://siteurl/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='domain\username' 5) Get Specific UserProfile Property of Specific User: For Office 365/SharePoint Online: http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,

SharePoint 2013: Working with User Profiles & JavaScript CSOM

<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.0.min.js"></script> <script src="/_layouts/15/SP.Runtime.js"></script> <script src="/_layouts/15/SP.js"></script> <script src="/_layouts/15/SP.UserProfiles.js"></script> 1. Get User Properties <Script type="text/javascript"> (function($){   $(document).ready(function(){          SP.SOD.executeOrDelayUntilScriptLoaded(loadUserData, 'SP.UserProfiles.js');   });   var userProfileProperties = [];      function loadUserData(){     var clientContext = new SP.ClientContext.get_current();           var peopleManager = new SP.UserProfiles.PeopleManager(clientContext);              var profilePropertyNames = ["PreferredName","PictureURL"];                var targetUser = "domain\\username";        var userProfilePropertiesForUser =

Whatz new in SP 2016

http://en.share-gate.com/blog/whats-new-in-sharepoint-2016

Force stop and start a full crawl on content sources in SharePoint 2013 using PowerShell

Get-SPEnterpriseSearchCrawlContentSource -SearchApplication "Search Service Application" | ForEach-Object {     if ($_.CrawlStatus -ne "Idle")     {         Write-Host "Stopping running crawl for content source $($_.Name)..."         $_.StopCrawl()                 do { Start-Sleep -Seconds 1 }         while ($_.CrawlStatus -ne "Idle")     }         Write-Host "Starting full crawl for content source $($_.Name)..."     $_.StartFullCrawl() } For Status Get-SPEnterpriseSearchCrawlContentSource -SearchApplication "Search Service Application" | select Name, CrawlStatus

Get SharePoint Log details using correlation Id using powershell

Get-SPLogEvent -StartTime (get-date).AddMinutes(-10) | where {$_.correlation -eq "Corr ID"} | Export-CSV "c:\Errors.csv" -notypeinformation

User Profile Sync Service stuck on ‘Starting’

Cause Farm account password was changed recently. It was only changed on application pool but was not applied globally via SharePoint CA. Resolution The password for the farm and UPA account was changed The change was made directly from the IIS manager and not from the SharePoint Central Administration Browsed to ‘CA > Security > Configure Managed accounts’ and applied the new password for the account. We granted the required permissions for the account in order to start the User Profile Synchronization Service Started the UPA Sync service successfully.

Close modal dialog when SPLongOperation Complete

protected override void OnClick(EventArgs e) { try{ using (SPLongOperation longOp = new SPLongOperation(this.Page)) { longOp.LeadingHTML = "Long Operation Title"; longOp.TrailingHTML = "This may take few seconds."; longOp.Begin(); //-------------------------- //here code part //--------------------- HttpContext context = HttpContext.Current; if (context.Request.QueryString["IsDlg"] != null) { context.Response.Write("<script type='text/javascript'>window.frameElement.commitPopup();</script>"); context.Response.Flush(); context.Response.End(); } else { string url = SPContext.Current.Web.Url; longOp.End(url, SPRedirectFlags.CheckUrl, context, string.Empty); } } } catch (ThreadAbortException) { /* Thrown when redirected */} catch (Exception ex) { SPUtility.TransferToErrorPage(ex.ToSt

@font-face failed OpenType embedding permission check. Permission must be Installable

Please add the below lines in the web.config file <system.webServer> <staticContent> <mimeMap fileExtension = ".woff" mimeType = "application/octet-stream" /> </staticContent> </system.webServer> Hope this will help you !!!

Change the "SharePoint" text in the top left corner (SuiteBar)

$webapp = Get-SPWebApplication "Your Site URL" $webapp.SuiteBarBrandingElementHtml ="Your New Text" $webapp.Update()

Insert 1 Millon Items in SP List using PowerShell

// Site URL $siteurl = "Your Site URL" // Assign Value $mysite=new-object Microsoft.SharePoint.SPSite($siteurl) $spWeb = $mysite.OpenWeb() $spList = $ spWeb.Lists [“TestList”] // Insert 1 million items $i = 1001 do { Write-Host “Item – “$i          $spitem = $ spList.Items.Add ()          $spitem[“Title”] = $i.tostring()          $spitem.Update()          $i++ } while ($i -le 1000000)

Unable to STOP microsoft sharepoint foundation web application service

Run the below command in PowerShell stsadm - o provisionservice - action start - servicetype spwebservice it will restart the service. More info https://technet.microsoft.com/en-us/library/ee748612.aspx  Hope this will helps you...

"Sorry, this site hasn't been shared with you." - SharePoint 2013

OK, How to solve this error?  Login to the site collection with either site collection administrator or Farm Admin (granted with "Full control" Web Application user policy!), grant appropriate access to the user in question by going to Site Settings >> People and Groups. Once you do this, users prompted for credentials instead of the Sorry, this site hasn't been shared with you error. Still getting same "Sorry, this site hasn't been shared with you."? Might be because of cached credentials from a prior browser session. Try clearing IE cache: Open a new browser window >> Go to Internet options >> In the general tab, click the Delete button >> Make sure that passwords and temporary Internet files are selected. Try different browser such as Firefox! If you didn't run product and configuration wizard after installation/patch, you may get this error even if you are a site collection administrator. Run it once and get rid of this is