Am creating my first form with custom code. My code uses Microsoft.SharePoint.Client for the following code snippet:
ClientContext clientContext = new ClientContext("http://local.sharepoint/community/mysite"); SP.List instruments_list = clientContext.Web.Lists.GetByTitle("Instruments"); CamlQuery cQuery = new CamlQuery(); ListItemCollection instrument_collection = instruments_list.GetItems(cQuery); clientContext.Load(instrument_collection); clientContext.ExecuteQuery();
Based on every example I can find this seems to be the correct way to do this and if I enable full trust trust it works fine in InfoPath but when I try to publish it and run it I get a "That assembly does not allow partially trusted callers.” error.
Is there either another way of accessing and updating the list that won't require me to use the Microsoft.SharePoint.Client or is there a way to fix the problem?
It also insists on loading in the form in the InfoPath client rather tan in the browser, which is what it has been set to do?