I’m trying to add Script Editor webpart from Sharepoint 2013 App to the host web page (the scheme is contained in webPartXml):
var oWebPartDefinition = this.limitedWebPartManager.importWebPart(webPartXml);
this.oWebPart = oWebPartDefinition.get_webPart();
this.limitedWebPartManager.addWebPart(this.oWebPart,'Left', 1);
this.context.load(this.oWebPart);
this.context.executeQueryAsync(Function.createDelegate(this, success), Function.createDelegate(this, error))
Iassigned a permission request Manage to my app in the site and site collection scopes.
<AppPermissionRequests>
<AppPermissionRequestScope="http://sharepoint/content/sitecollection/web"Right="Manage" />
<AppPermissionRequestScope="http://sharepoint/content/sitecollection"Right="Manage" />
</AppPermissionRequests>
Based on this article, permission request Manage contains following permissions:
- Write permissions, plus:
- Manage Lists
- Add and Customize Pages
- Apply Themes and Borders
- Apply Style Sheets
Based on this article, «To add or edit Web Parts that developers have marked as unsafe for editing, SharePoint 2010 Products users and SharePoint 2013 users must have the Add and Customize Pages permission».
So, the app has “Add and Customize Pages” permission and current user has permission level “Full Control”, but when the app adds webpart it throws an error «A Web Part or Web Form Control on this Page cannot be displayed or imported. You don't have Add and Customize Pages permissions required to perform this action».
There is no error if I add the TypeName of the webpart in the SafeControl entry, or set AppPermissionRequest to Full Control, but this doesn’t apply to me. Any help appreciated!
Gleb