Create Site From Template using SharePoint 2013 Workflow - System.UnauthorizedAccessException error

Hello,

I followed this blog to create a workflow: https://www.dmcinfo.com/latest-thinking/blog/id/8661/create-site-from-template-using-sharepoint-2013-workflow

The workflow completes without errors in SharePoint but in the log e-mail that I receive I get the following error:

responsecontent: {"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You are not authorized to perform this action or access this resource."}}}

I did the elevated permissions part mentioned here: https://msdn.microsoft.com/en-us/library/office/jj822159(v=office.15).aspx

I've been trying to solve this issues for days now with a few colleagues and we don't understand where it is that we don't have sufficient permissions. We are global admins for our SharePoint Online tenant, we are site collection owners and site owners.

So, where is it that we don't have sufficient permissions? Or is it maybe the workflow app that runs with a service account that doesn't have sufficient permissions??

Can anyone help us out here?

Thanks for your time.

Regards,

Albert

May 27th, 2015 8:26am

Hi Albert,

I tested the same scenario per the link provided in your post in my SharePoint Online site, however the site was created successfully.

There are some notes in the workflow, please make sure that the steps below are correct in your workflow, otherwise you will get the unauthorized error:

  1. The workflow App permission has been trusted with full control permission.
  2. Make sure that the value for Type in metadata dictionary is SP.WebInfoCreation in the workflow.
  3. Make sure that the __metadata in parameters dictionary is correct. It should be __ not _ in the workflow.

Please check each step in your workflow to make sure that the steps are correctly set.

Best regards,

Victoria

Free Windows Admin Tool Kit Click here and download it now
May 28th, 2015 3:37am

Hello Victoria,

Thank you for the quick reply.

I double checked everything and I still get the unauthorized error :-(

I really don't understand what is wrong.

I even recreated the workflow on a different O365 tenant, but same error.

Somewhere the permission part goes wrong and I don't know where.

Do you have any other tips of what I could check?

Thanks!

May 28th, 2015 7:59am

We too got the same issue, and verified multiple permission levels and tired different options.

Atlast the impersonation worked out with Farm Account User. 

Use the below code at the start of your code 

 WindowsImpersonationContext wiContext = CreateIdentity("FARMACCOUNT", "DOMAIN", "FARMACCOUNTPWD").Impersonate();

At the end Reset the Impersonation with following line

 wiContext.Undo();

Let me know if you have any queries.

Thanks, Dinesh


Free Windows Admin Tool Kit Click here and download it now
May 28th, 2015 11:10am

Hi Dinesh,

Thank you for the reply and the offered solution.

But, what do you mean with code? I followed the steps in the blog that I mention in my first post. 

Do you mean that I should add an action or condition in the App Step??

I don't see the option to add code in SharePoint Designer 2013, or am I missing something??

Awaiting your reply.

Thank you!

May 28th, 2015 11:17am

Hi Albert,

I recommend to clear SharePoint Designer cache and then re-create the workflow to see how it works.

http://www.c-sharpcorner.com/UploadFile/sagarp/how-to-clear-your-sharepoint-designer-20102013-cache/

Please create the site with the template in UI to see if the site can be created.

In the meanwhile, you can post your question to the forum for Office 365: http://community.office365.com/en-us/f/default.aspx .
More experts will assist you, then you will get more information relation to SharePoint Online.

Best regards,

Vi

Free Windows Admin Tool Kit Click here and download it now
May 31st, 2015 11:15pm

Hello Victoria,

Thank you for the reply.

I cleared the cache and re-created the workflow, makes no difference.

I will post my issue on the O365 forum you provided, thank you.

Regards,

Albert

June 1st, 2015 2:00am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics