Skip to main content

Posts

Showing posts from May, 2016

How to get Document Type Icon using MapToIcon REST Endpoint

If you look at a Document Library View, you will also notice Document Type column which shows the icon corresponding to the Document Type. If it is a word document, it shows MS Word symbol as shown below. Document Icon is highlighted There could be scenarios where you would need to display the documents in a custom view and you would also want to make use of these icons. However this is not a very straightforward approach and this post will show you how to get that! I was using REST API to get items from the library. So obviously I was looking at any column which would give me access to these icons. When I got into the columns in the response, the one which caught my attention was the field "DocIcon". But, this field contains only the extension of the document. For example, "docx", "html", "jpg" etc. So DocIcon was of no use as I wanted to get the image URL. I also started looking at any endpoint which would get me this URL. During t

How to update Person field with multiple values using REST API

Person or Group field in SharePoint is similar to a Lookup field. When you are updating this field using REST API, you need to append "Id" to the name of the column in the body construct. For example, the body construct looks like this: data: { "__metadata": { "type": "SP.Data. ListName ListItem" }, "Title": "First Item", " PeopleField Id": "4" }; The highlighted portions should be replaced by the actual List Name and Column Name. In the above example, the REST call is updating a List item with Title and People columns. How to get the value for user ID ("4" in the above example) needs a separate explanation and that will be my next post! The above example works fine if Person field is configured to accept only one value. If we change the Person field to accept multiple values, how do we pass more than one value in the REST call? Since we normally separate user names with semicolon in peop