none
UnauthorizedAccessException calling REST API from Workflow when trying to create subsite

    Question

  • Scenario
    I want to create a workflow in Sharepoint Online that creates a subsite through REST call. The Workflow is started from : 
    https://company.sharepoint.com/sites/sitecoll/subsite1/ 
    and should create subsites under subsite1 for example : 
    https://company.sharepoint.com/sites/sitecoll/subsite1/subsite2

    Problem
    I created a workflow that calls "_api/web/webinfos/add" and enabled app permissions on the site.

    Error message
    {"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"sv-SE","value":"Access denied. You do not have permission to perform this action or access this resource."}}} (translated from English to Swedish)

    Any ideas? Could I have setup the app permissions wrong?


    Monday, January 2, 2017 12:54 PM

All replies

  • Hi,

    Firstly, please check if the sub site has been created successfully, even if you have received an error.

    Please make sure that the Call HTTP Web Service step is added in App Step.

    Please refer to the following article, check if you have set app permission correctly:

    https://msdn.microsoft.com/en-us/library/office/jj822159.aspx?f=255&MSPPError=-2147217396

    Detailed steps about how to create sub site via designer workflow for your reference:

    http://www.connectorman.com/create-sites-with-spd-2013-workflow/

    Thanks,

    Dean Wang


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Tuesday, January 3, 2017 8:48 AM
    Moderator
  • Hi Dean and thanks for your help.

    No subsite is created and the call is made in an App Step.

    I have followed the steps from your link with no success I still get the same UnauthorizedAccessException error

    The App permissions is setup as follows:

    <AppPermissionRequests>
         <AppPermissionRequest Scope="http://company.sharepoint.com/sites/Extranet/Project" Right="FullControl"/>
    </AppPermissionRequests>

    The Workflow is running from the Project site and the subsite should be created under Project.

    Any idea?

    Tuesday, January 3, 2017 12:39 PM