Quantcast
Channel: Developing Apps for SharePoint 2013 forum
Viewing all articles
Browse latest Browse all 8089

How to provision app web list permissions in a SharePoint Hosted app

$
0
0

Hi

I have a SharePoint Hosted app where I provision a custom list instance to the app web using c#/CSOM.  I am on a local server hosting SharePoint 2013 and Visual studio 2012.  The app works as designed - list provisioned and remote event receivers function.  I am now trying to have the app provision permissions.

I am trying to use the appinstalled event to break inheritence on the list and modify permissions through CSOM.

My first problem is an error - "the remote name could not be resolved: app-guid.appurl" on ClientContext.ExecuteQuery();. 

I am assuming once I access the web object and get the list, I can use list.BreakRoleInheritance(true,false) and then change permissions?  Or, am I on the wrong track completely?

Here is a code segment to illustrate where I am having trouble getting the web object.

using Microsoft.SharePoint.Client; using Microsoft.SharePoint.Client.EventReceivers; namespace RemoteEventAppWeb.Services { public class AppEventReceiver : IRemoteEventService { public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties) { SPRemoteEventResult result = new SPRemoteEventResult(); if (properties.EventType== SPRemoteEventType.AppInstalled) { ClientContext clientContext = new ClientContext(properties.AppEventProperties.AppWebFullUrl); if (clientContext != null) { Web web = clientContext.Web; clientContext.Load(web); clientContext.ExecuteQuery();//ERROR! } } return result; } public void ProcessOneWayEvent(SPRemoteEventProperties properties) { } } }

Thanks


Viewing all articles
Browse latest Browse all 8089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>