Document Set Creation in document library using REST API in Sharepoint 2013

Hi,
I want to create the document set using REST API call. Currently i am able to create the folder and able to upload the files using REST API's in the document library. Is there any way we can pass the contentype name or Id and create the document set using
REST API call. We need to create the document set along with metadata and upload the files inside the document set.
I need to create the document set along with meta data column values using REST API. Please let me know how we can achieve this through REST API.
Thank you,
Mylsamy

Hi,
According to your post, my understanding is that you wanted to create document set along with managed metadata fields.
The REST API does not currently support working with Managed Metadata or Taxonomy fields.
As a workaround, we can use the JavaScript Client Object Model.
Create document set using JavaScript Client Object Model.
http://blogs.msdn.com/b/mittals/archive/2013/04/03/how-to-create-a-document-set-in-sharepoint-2013-using-javascript-client-side-object-model-jsom.aspx
http://social.technet.microsoft.com/Forums/sharepoint/en-US/aacd96dc-0fb2-4f0d-ab4c-f94ce819e3ed/create-document-sets-with-javascript-com-sharepoint-2010
Set managed metadata field with JavaScript Client Object Model.
http://sharepoint.stackexchange.com/questions/95933/add-list-item-with-managed-metadata-field-through-jsom
http://sharepointfieldnotes.blogspot.com/2013/06/sharepoint-2013-code-tips-setting.html
Thanks,
Jason
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Jason Guo
TechNet Community Support

Similar Messages

  • Audit usage for REST API in SharePoint 2013

    Hi,
    Is there any OOB way for SharePoint to log access in REST API so that it will track which application/user uses the REST API?
    Thanks,
    Kenny

    Hi,
    According to your post, my understanding is that you wanted to audit usage for REST API in SharePoint 2013.
    Per my knowleadge, there is no out of the box way to accomplish this with SharePoint.
    SharePoint 2013 introduces a Representational State Transfer (REST) service that is comparable to the existing SharePoint
    client object models.
    This means that developers can perform Create,
    Read, Update, and Delete (CRUD) operations from their apps for SharePoint, solutions, and client applications, using REST web technologies and standard Open Data Protocol (OData) syntax.
    More information:
    REST API reference and samples
    Thanks,
    Linda Li
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Linda Li
    TechNet Community Support

  • How to retrieve the users that are following a document using JSOM / REST APIs in SharePoint 2013

    Hi everyone,
    Does anyone know how to use JSOM / REST APIs to retrieve the users that are following a specific document in SharePoint 2013? 
    Thanks in advance,
    Nam

    Hi Nam,
    Please use the sample code to get the followers for the document. Courtesy: Mokhtar
    Bepari 
    using Microsoft.SharePoint.Client;
    using Microsoft.SharePoint.Client.Social;
    ClientContext clientContext = new ClientContext("http://URL");
    SocialFollowingManager followingManager = new SocialFollowingManager(clientContext);
    SocialActorInfo actorInfo = new SocialActorInfo();
    actorInfo.ContentUri = "<documenturl>"; //set the document url.
    actorInfo.ActorType = SocialActorType.Document;
    //By using the GetFollowed method you can get the people who the current user is following.
    ClientResult < SocialActor[] > followedResult = followingManager.GetFollowed(SocialActorTypes.Users);
    //By using the GetFollowers() method you can get the people who are following the current user.
    ClientResult < SocialActor[] > followersResult = followingManager.GetFollowers();
    clientContext.ExecuteQuery();
    Once you get the resultset you can iterate like below:
    foreach(SocialActor actor in followedResult)
    string name = actor.Name;
    string imageURL = actor.ImageUri;
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • How to update and delete using rest services in SharePoint 2013..

    I am looking to create,update and delete data in SharePoint list where i am using below code for creating data..I should be performing three operations on single button click how can i achieve this.Below is the code i am using for creating data to list and
    displaying in CEWP.
    <html>
    <head>
    <style type="text/css">
    #mytable{
    border : 1px solid;
    </style>
    <script type="text/javascript" src="https://sharepointapp28.sharepoint.com/sites/Dev2013/SiteAssets/Scripts/jquery-1.11.1.min.js" ></script>
    <script type="text/javascript">
    var ListName;
    var webUrl;
    $(document).ready(function(){
     SP.SOD.executeFunc('sp.js', 'SP.ClientContext', sharePointReady);//Doubt
    function sharePointReady() {
    webUrl = _spPageContextInfo.siteAbsoluteUrl;
    ListName = "test"; 
    $('#btnSub').click(function () {
    updateItem();
    function updateItem() {
    var name = $('#txtName').val();
    var Desc = $('#txtDesc').val();
    var city = $('#txtCity').val();
        var itemType = GetItemTypeForListName(ListName);
        var item;
            item = {
                '__metadata': { "type": itemType },
                'Name': name,
                'Description': Desc,
                'City': city
        var xmethod = 'POST';
        jQuery.ajax({
            url: webUrl + "/_api/web/lists/getbytitle('" + ListName + "')/items",
            type: "POST",
            data: JSON.stringify(item),
            contentType: "application/json;odata=verbose",
            headers: {
                "Accept": "application/json;odata=verbose",
                "X-RequestDigest": $("#__REQUESTDIGEST").val()
            success: onUpdateMSOPProcessSuccess,
            error: onUpdateMSOPProcesFail
        function onUpdateMSOPProcessSuccess(data) {
    alert('successfully updated to MyList!!!')
        function onUpdateMSOPProcesFail(data) {
            alert(data.d.err);
    function GetItemTypeForListName(name) {
        return "SP.Data." + name + "ListItem";
    </script>
    </head>
    <body>
    <table style="width:500px" id="mytable">
    <tr><td colspan="3">&nbsp;</td></tr>
    <tr><th colspan="3">Rest API</th></tr>
    <tr><td colspan="3">&nbsp;</td></tr>
    <tr><th>Name</th> <td> : </td> <td> <input type="text" id="txtName" /> </td></tr>
    <tr><th>Description</th> <td> : </td> <td> <input type="text" id="txtDesc" /> </td></tr>
    <tr><th>City</th> <td> : </td> <td> <input type="text" id="txtCity" /> </td></tr>
    <tr><td colspan="3">&nbsp;</td></tr>
    <tr><th></th><td colspan="2" align="left"><input type="button" value="submit" id="btnSub" /></th></tr>
    <tr><td colspan="3">&nbsp;</td></tr>
    </table>
    </body>
    </html>

    Hello,
    With one button you want to perform 3(Create, Update and Delete) operation
    To create:
    First check whether the data exist with full combination of Name,Desc and City.
    If not exist you can execute the create function.
    If exist, get confirmation to delete the item by pop up. Using item ID you can perform Delete operation
    To Update:
    How you want to update the item, by keeping unique value or combination of columns?
    based on that you can perform the update operation.
    Whenever you see a reply and if you think is helpful, click "Alternate TextVote As Helpful"! And whenever you see a reply being an answer to the question of the thread, click "Alternate TextMark As Answer

  • Best practice for development using REST API - OData

    Hi All, I am new to REST. I am a developer who works mostly in server-side code using Visual Studio. Now that Microsoft is advocating to write code using REST API instead of server-side code or client side object model, I am trying to use REST API.
    I googled and most of the example shows to write a code and put it on Content Editor/Script Editor. How to organize code and deploy to the staging/production in this scenario? Is there any Best Practice or example around this?
    Regards,
    Khushi

    If you are writing code in aspx or cs it does not mean that you need to deploy it in the SharePoint server, it could be any other application running from your remote server. What I mean it you can use C# & Rest API to connect to SharePoint server.
    REST API in SharePoint 2013 provides the developers with a simple standardized method of retrieving information from SharePoint and it can be used from any technology that is capable of sending standard HTTP requests.
    Refer to the following blog that provide your more details about comparison of the major features of these programming choices/
    http://msdn.microsoft.com/en-us/library/jj164060.aspx#RESTODataA
    http://dlr2008.wordpress.com/2013/10/31/sharepoint-2013-rest-api-the-c-connection-part-1-using-system-net-http-httpclient/
    Hope this helps
    --Cheers

  • Using REST API to promote Document Properties into SharePoint document library

    Hi,
    Is it possible to extract Document properties of a file and update library column using REST API?
    Thanks,
    techie

    Hi,
    We can use the following REST endpoint to get document property:
    http://site/_api/web/getfilebyserverrelativeurl('/Shared Documents/filename.docx')/<property name>
    https://msdn.microsoft.com/en-us/library/office/dn450841(v=office.15).aspx#bk_File
    If you want to update document library column, the following blog for your reference:
    Updating SharePoint List items with SharePoint’s REST API in JavaScript
    http://community.rightpoint.com/blogs/viewpoint/archive/2014/10/23/updating-sharepoint-list-items-with-sharepoint-s-rest-api-in-javascript.aspx
    Thanks,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Dennis Guo
    TechNet Community Support

  • Update Shared Column on Document Set creation

    hi,
    I have a cloud business app connected to sharepoint online,
    on certain actions i create a document set in a sharepoint library , the document set i use has a shared column set - i would like to set this value at creation time or just after creation so that any documents added inherit the value.
    from the cloud business app i am using the CSOM to create the document set (based on steven curran's post
    http://sharepointfieldnotes.blogspot.com/2010/06/making-your-sharepoint-2010.html)
    Any ideas?
    Thx

    Hi mrP,
    According to your description, my understanding is that you want to update the shared column on document set creation.
    I suggest you create a workflow to do it.
    You can create the workflow as the below:
    For the workflow Start Options, select “Start workflow automatically when an item is created”.
    After the above, publish the workflow.
    Best Regards,
    Wendy
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Move Files from one document set to another document set using workflow

    Hi All,
    Env : SP 2013 Server - SPD 2013.
    I'm trying to make a SPD Workflow that must copy a  files from one Document Set to another Document set in the same library other document library  
    Does Someone already get success for Copy  files from one Document Set to another Document set?
    Thanks for your help.

    Hi,
    According to your post, my understanding is that you wanted to move Files from one document set to another document set using workflow.
    I recommend to use the custom workflow activity  Copy List Item Extended Activityto
    copy files to another document set.
    You can do this with codeless SharePoint Designer workflows as long as you can install the
    Codeplex Custom SharePoint Designer Workflow Activities. 
    These activities are also built-in to SPD2013. However, you can only use the custom activities in the SharePoint 2010 Platform.
    To install the custom activities, please follow the steps as below:
    Download the solution file form
    Useful Sharepoint Designer Custom Workflow Activities
    Copy the wps file to the Disk C.
    Open the SharePoint 2013 Management Shell.
    Run the command: add spsolution c:\ dp.sharepoint.workflow.wsp
    Open the Center Administration, click System Setting->Manage Farm Solution-> dp.sharepoint.workflow.wsp->Deploy to one or more Web Application.
    Open the SharePoint designer, create SharePoint 2010      Platform workflow, add action from Custom Actions.
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Document setting prevent placing a signature using Adobe Reader

    Created a statis pdf witha  digital signature field in Adobe Livecycle designer, also tried in Acrobat PRO, saved as a PDF, when opening the file under Adobe Reader X or Adobe Reader 8 get sam eissue adobe reader will not allow the signature or document ot be changed, get a warning that saya "document setting prevent placing a signature using Adobe Reader"
    Sorry I am new to Adobe, what does Reader want, I do not have this issue when I open the file under Acrobat PRO or Livecycle.
    Thanks

    This forum is only for discussions on the forums themselves. You may want trying to post your question in the Reader forum.

  • Document Set issue - Missing documents

    after changing meta data on a document set, all documents in the document set disappear.  Is there a fix for this?

    I may have found the bug.  If a document set contains a group that the documents also contain and the document set permissions are removed and the group is readded, the documents disappear.  Even if the documents have unique permisions and do
    not inherit from the document set.  The documents are now unaccessible and lost.

  • Set rating settings in Sharepoint library using JSOM api.

    Is it possible to set rating settings in Sharepoint library using JSOM api/ Client side?
    Ashish Baranwal || To know what you know and what you do not know, that is true knowledge

    HI,
    Please check the below url for reference.
    https://social.msdn.microsoft.com/Forums/office/en-US/5069c9b8-7427-4749-bd98-cfc0f492c3a2/how-to-enable-ratings-on-sharepoint-list-using-client-object-model-for-office-365-sharepoint-site?forum=sharepointdevelopment
    https://samlman.wordpress.com/2015/03/02/how-to-use-csom-with-ratings-in-sharepoint-2013/
    Don't forget to mark it as an Answer if it resolves your issue and Vote Me as helpful if it useful.
    Mahesh

  • Add user to sharepoint group using REST API

    I am trying to add a user to sharepoint group with following code
    serviceUrl= Appweb + "/_api/SP.AppContextSite(@target)/web/sitegroups("+GroupId+")/users?@target='host web'";
        $.ajax({
            url: serviceUrl,
            type: "POST",
            contentType: "application/json; charset=utf-8",
            dataType: 'json',
            body: "{'__metadata': { 'type': 'SP.User' },'LoginName':'i:0#.f|membership|'+email }",
      headers: {"accept":"application/json;odata=verbose",
        "content-type": "application/json;odata=verbose",
        "X-RequestDigest":$("#__REQUESTDIGEST").val()
        async: false,
      success: function (data) {
               alert('success');
      error: function (data) {
                 alert('fail');
    The request goes to error function. Response of the request is Microsoft.SharePoint.Client.InvalidClientQueryException and message is A node of type 'EndOfInput' was read from the JSON reader when trying to read the start of an entry. A 'StartObject' node was
    expected
    I tried the sample from following link but fail it
    https://msdn.microsoft.com/en-us/library/office/dn531432.aspx

    Hi,
    Per my understanding, you might want to add an user to a SharePoint group in host web from a SharePoint Hosted App using REST API.
    Here is a working demo for your reference:
    var hostweburl;
    var appweburl;
    $(document).ready(function () {
    //Get the URI decoded URLs.
    hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));
    appweburl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl"));
    // Resources are in URLs in the form:
    // web_url/_layouts/15/resource
    var scriptbase = hostweburl + "/_layouts/15/";
    // SP.RequestExecutor.js to make cross-domain requests
    $.getScript(scriptbase + "SP.RequestExecutor.js", loadPage);
    // Utilities
    // Retrieve a query string value.
    // For production purposes you may want to use a library to handle the query string.
    function getQueryStringParameter(paramToRetrieve)
    var params = document.URL.split("?")[1].split("&");
    for (var i = 0; i < params.length; i = i + 1)
    var singleParam = params[i].split("=");
    if (singleParam[0] == paramToRetrieve) return singleParam[1];
    function addUsersInGroup() {
    var executor;
    // Initialize the RequestExecutor with the app web URL.
    executor = new SP.RequestExecutor(appweburl);
    executor.executeAsync({
    url: appweburl + "/_api/SP.AppContextSite(@target)/web/sitegroups(8)/users?@target='" + hostweburl + "'",
    method: "POST",
    contentType: "application/json; charset=utf-8",
    dataType: 'json',
    body: "{'__metadata': { 'type': 'SP.User' },'LoginName':'i:0#.f|membership|[email protected]'}",
    headers: {
    "Accept": "application/json; odata=verbose",
    "content-type": "application/json;odata=verbose",
    "X-RequestDigest":$("#__REQUESTDIGEST").val()
    success: addUsersInGroupSuccessHandler,
    error: addUsersInGroupErrorHandler
    function addUsersInGroupSuccessHandler(data)
    console.log(data);
    var jsonObject = JSON.parse(data.body);
    console.log(jsonObject);
    function addUsersInGroupErrorHandler(data)
    console.log(data);
    var jsonObject = JSON.parse(data.body);
    console.log(jsonObject);
    Thanks 
    Patrick Liang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected].

  • How to get permission of a sharepoint list for a user using REST api

    Hi there,
    I have a requirement where i need to check the access permission of a user against a List or Library only using REST api from my remote salesforce app. [I already have access token and I am able to view list, add item etc..]
    Say for example, I have to send the list name and user name, and get the result as Read, Write, Contribute(Manage), None. I need to display what permission does that user have for that List.
    How do I achieve this. Please help me.
    Thanks in advance.

    Hi,
    For High and low bits, we can create a new SP.BasePermissions object to use like below:
    function success(data){
    var permissions = new SP.BasePermissions();
    permissions.set(SP.PermissionKind.manageLists);
    var hasPermission = permissions.hasPermissions(data.d.EffectiveBasePermissions.High, data.d.EffectiveBasePermissions.Low);
    Here is a detailed article for your reference:
    http://www.lifeonplanetgroove.com/checking-user-permissions-from-the-sharepoint-2013-rest-api/
    Thanks
    Best Regards
    Jerry Guo
    TechNet Community Support

  • Sharepoint-Hosted App giving FORBIDDEN error when i use REST Api

    Hi,
    I have created a sharepoint hosted app which will create Team site on button click.
    I used REST Api  and  NAPA Tool to develop this app.
    Napa tool gives to things ClientWebpart.aspx and Default.aspx.
    When i run my Default.aspx code is working fine but ClientWebpart.aspx is giving FORBIDDEN error when i am trying to create site.
    Below is the code which i used to create site
    code:
    var hostweburl;
    var appweburl;
    $(document).ready(function () {
    hostweburl= decodeURIComponent(getQueryStringParameter("SPHostUrl"));
    appweburl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl"));
    function createSPWeb() {
    $.ajax(
    url: appweburl +
    "/_api/SP.AppContextSite(@target)/web/webinfos/add?@target='" +
    hostweburl + "'",
    type: "POST",
    data: JSON.stringify(
    'parameters':
    '__metadata': { 'type': 'SP.WebInfoCreationInformation' },
    'Url': 'RestSubWeb',
    'Title': 'RestSubWeb',
    'Description': 'REST created web',
    'Language': 1033,
    'WebTemplate': 'sts#0',
    'UseUniquePermissions': false
    headers: {
    "accept": "application/json;odata=verbose",
    "content-type": "application/json;odata=verbose",
    "X-RequestDigest": $("#__REQUESTDIGEST").val()
    success: successHandler,
    error: errorHandler
    NOTE:This is on sharepoint online.
    Please help
    Regards,
    sudeep

    So in the app you are testing, are you using the FQDN or the NetBIOS name? Bad practice but could you test with both (hard code the absolute URL for testing purposes) then retest your app?
    If you are making a web part based on the new app model this will be an "app part" and probably have the same issues you are experiencing. If this is for something internal rather than a product you are developing to resell then the script editor /
    content editor web part approach could work for you.
    Paul
    Paul Mather | Twitter |
    http://pwmather.wordpress.com | CPS

  • How to update 500 list items using Rest API

    Hi All,
    i have requirement that is "required to update 500 list items using rest Api".
    how can i do it,please share your thoughts with me.
    Thanks,
    Madhu.

    Didn't get you correctly, if you asking reference for REST API to update list items please refer below links
    http://msdn.microsoft.com/en-us/library/office/jj164022(v=office.15).aspx
    Destin -MCPD: SharePoint Developer 2010, MCTS:SharePoint 2007 Application Development

Maybe you are looking for