How to get WssID for new taxonomy value in the REST Post call?

How to get WssID for new taxonomy value in the REST Post call?

So I looked for this and I found various places to use CSOM or JavaScript way to get the WssId.

But it is quite simple for the RESP Post call. You simply needs to pass WssId = -1 for example

‘CONSTOSO-TAX-FLD’: {
“__metadata”: { “type”: “SP.Taxonomy.TaxonomyFieldValue” },
“TermGuid”: ’07bda450-b080-4c2b-a239-c9cca8418fc3′,
“WssId” : -1
},

Posted in SharePoint 2013 | Leave a comment

SPRemoteAPIExplorer cool tool for the developers

The SP Remote API Explorer is pretty cool utility for developers.

https://visualstudiogallery.msdn.microsoft.com/26a16717-0c9a-4367-8dfd-bb09e7e2deb5?SRC=Home

The utility can be installed on the developer VM with SharePoint and Visual Studio. The utility pre requisite is you will need local SP farm with Visual Studio.

But once you have all required pre requisite then you can navigate to SP objects and its methods and properties to check what is supported by CSOM, REST & Silverlight Objects.

Posted in Uncategorized | Leave a comment

How to navigate to ‘User Photos’ List on my site host?

If you are not aware that the user pictures are stored in the my-site host site collection. The pictures are stored in the ‘User Photos’ list’s folder named ‘Profile Pictures’. There will be three types of picture for an User i.e. Small (S), Medium(M) and Large(L)

Tip to navigate is:

  1. Make a copy of the following string in the clipboard
    • ‘/_layouts/15/settings.aspx’
  2. Navigate to the ‘About Me’ by clicking your picture on the top right side of your SharePoint Site.
    • It may look like ‘https://pankajsurti-my.sharepoint.com/_layouts/15/start.aspx#/PersonImmersive.aspx?ajaxdelta=1’
  3. Now delete the url string after ‘.com’ so new url should be like the following.
    • ‘https:// pankajsurti-my.sharepoint.com/_layouts/15/settings.aspx’
  4. Voilà – you should now see the ‘User Photos’ list.

I hope this helps you. J

Posted in MOSS 2007, SharePoint, SharePoint 2010, SharePoint 2013 | Leave a comment

Workaround for correctly retrieving Single select taxonomy field Label value via REST

Problem:

I have list names “Experts” with a Metadata Column as ContosoLevel. When I retrieve the column via REST call I get only following in the response for the column.

“ContosoLevel”:{“__metadata”:{“type”:”SP.Taxonomy.TaxonomyFieldValue”},“Label”:”1″,”TermGuid”:”47dd115d-7399-46d1-b985-205e499bbbdd”,”WssId”:1}

I was expecting the Label field will have the term value.

REST Call: GET /sites/PankajSandBox/_api/web/lists/getByTitle(‘Experts’)/items

Also I noticed that when I change the column as MultiSelect, the REST call works.

Solution:

The solution to use the POST method with the CAML query. The single select values will be returned. Please make sure you pass the “X-RequestDigest” value in your POST request.

Once I followed the steps. I was able to get the values as following.

“ContosoLevel”:{“__metadata”:{“type”:”Collection(SP.Taxonomy.TaxonomyFieldValue)”},”results”:[{“Label”:”Chief Engineer”,”TermGuid”:”47dd115d-7399-46d1-b985-205e499bbbdd”,”WssId”:1}]}

REST Call: POST /sites/PankajSandBox/_api/web/lists/getByTitle(‘Experts’)/GetItems(query=@v1)?@v1={‘ViewXml’:'<View><Query></Query></View>’}

Please see the following blog which helped me.

http://sharepointificate.blogspot.co.uk/2014/05/taxonomy-columns-sharepoint-2013-list.html?showComment=1411555297896&_sm_au_=iFVS4N0LQ7sf9STj

Posted in SharePoint 2010, SharePoint 2013 | 1 Comment

Why SPAppWebUrl is empty string for the SharePoint 2013 provided hosted App?

I created a new SharePoint Provided Hosted App. In the app added a single App part using the add item template. I used the {StandardTokens} in the query string of the start page. I got all other values but the SPAppWebUrl was empty string. The problem is there was no app items being provisioned on the site so the SPAppWebUrl was not passed to the query string.

Solution:

The simple solution is I added a “dummyList” this created a feature. I deployed the app and tested this time the SPAppWebUrl was passed.

I hope this helps someone.

Posted in Uncategorized | Leave a comment

How to change default browser for debugging SharePoint 2013 Apps?

Answer: Basically create a dummy new ASP.NET Web application. Change the debug browser menu and run the app. Close the dummy app. Open your SharePoint 2013 App and you should have your browser changed.

I don’t know why there is no better way to set default browser for the SharePoint 2013 for debugging.

The following link is the source for the content:

Set Default Browser for Debugging SharePoint 2013 Apps

Posted in SharePoint 2013 | Leave a comment

How to list the all web parts on a page?

The webparts are on the page. There is a simple way to list all web parts on the page. Simply add “?contents=1” after the page. This will list all the webparts present on the page. You can select and delete any web parts.

Posted in Uncategorized | Leave a comment

Securing REST Web API in ASP.NET

The REST Web Api endpoint the customer has developed & deployed to Azure website has anonymous access. The REST end point must be secured. I was investigating the best and easier way to secure the REST endpoint in ASP.NET.

There are multiple ways to secure the REST end point.
1. Open ID (RSA key pair)
2. OAuth

The OAuth will require bit of the work which can be done using Azure AD as the claims provider. However Open ID is very well received in the community and easy to implement by using the RSA key pair. The details of RSA key pairs is discussed in the following blog post.

Making your ASP.NET Web API’s secure -> http://codebetter.com/johnvpetersen/2012/04/02/making-your-asp-net-web-apis-secure/

I coded a sample REST Web API to test it out. It works.

In Summary,

• Using the RSACryptoServiceProvider class create the public / private key.
• Encrypt the token using RSAClass.Enrypt
• Using Fiddler pass the token “Authorization-Token” in the header.

Please see the following other links for the reference on this topic:
https://stormpath.com/blog/secure-your-rest-api-right-way/
http://msdn.microsoft.com/en-us/library/hh446531.aspx
http://blog.cloudfoundry.org/2012/10/09/securing-restful-web-services-with-oauth2/
http://jamiekurtz.com/2013/01/14/asp-net-web-api-security-basics/
http://www.allenconway.net/2012/05/creating-wcf-restful-service-and-secure.html
http://codebetter.com/johnvpetersen/2012/04/02/making-your-asp-net-web-apis-secure/

Token based Authentication for WCF HTTP/REST Services: Authentication

Posted in Azure | Leave a comment

SideWaffle template for AngularJS on Visual Studio

The Side Waffle is very useful for the Angular JS development.
http://sidewaffle.com/

VsCommands for Visual Studio 2013 is useful add ins.

Posted in Uncategorized | Leave a comment

Breeze & SharePoint 2013

Breeze is a cool framework to make REST calls from the client side. To better explain Andrew Connal’s blog explains in details http://www.andrewconnell.com/blog/getting-breezejs-to-work-with-the-sharepoint-2013-rest-api.
The only problem is that it can not do the cross domain calls so the lists on the host web can not work for this sample. (Please correct me if I am wrong)

Posted in Uncategorized | Leave a comment