Tuesday, 27 May 2014

SharePoint 2013: Get UserProfile Properties with REST API

Thanks to 

http://www.vrdmn.com/2013/07/sharepoint-2013-get-userprofile.html


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='i:0%23.f|membership|vardhaman@siteurl.onmicrosoft.com'

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,propertyName='LastName')?@v='i:0%23.f|membership|vardhaman@siteurl.onmicrosoft.com'


For SharePoint 2013 On-Premise:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='LastName')?@v='domain\username'



6) Get Multiple UserProfile Properties for Specific User:


http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertiesFor

Sunday, 18 May 2014

My validators are not working

This was working 

<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ForeColor="Red" ErrorMessage="* This field cannot be blank." ControlToValidate="FunctionGroup">
</asp:RequiredFieldValidator>

...

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ForeColor="Red" ErrorMessage="* This field cannot be blank." ControlToValidate="FunctionGroup">
</asp:RequiredFieldValidator>


As soon as I changed it to 

<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ForeColor="Red" ErrorMessage="* This field cannot be blank." ControlToValidate="FunctionGroup">
</asp:RequiredFieldValidator>

...

<!--

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ForeColor="Red" ErrorMessage="* This field cannot be blank." ControlToValidate="FunctionGroup">
</asp:RequiredFieldValidator>

 -->

it stopped working. So if you don't want to use validator, instead of commentting out it, delete it.

Thursday, 1 May 2014

SharePoint Search REST API not returning all subsites

This query is not working !!! I have 10 subsites, but it only returns 2 of them.
https://serverURL/_api/search/query?querytext='path:"*********"  contentclass:STS_Web'&rowlimit=20

Solution is to add &trimduplicates=false at the end of the query.
https://serverURL/_api/search/query?querytext='path:"*********"  contentclass:STS_Web'&rowlimit=20&trimduplicates=false




SharePoint Designer Cache Locations

  • %APPDATA%\Microsoft\Web Server Extensions\Cache
  • %USERPROFILE%\AppData\Local\Microsoft\WebsiteCache