I am trying to set the navigational properties in SP2013 autohosted app. I am doing this at App installed receiver. I have written below code for that, which is failing with error message:
- The remote event receiver callout failed. Details: The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.
Below is the code I am using:
public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties) { SPRemoteEventResult result = new SPRemoteEventResult();
using (ClientContext clientContext = TokenHelper.CreateAppEventClientContext(properties, false))
{
if (clientContext != null)
{
clientContext.Load(clientContext.Web);
clientContext.ExecuteQuery();
if (properties.EventType == SPRemoteEventType.AppInstalled)
{
clientContext.Load(clientContext.Web);
clientContext.ExecuteQuery();
try
{
WebNavigationSettings webNavigationSetting = new Microsoft.SharePoint.Client.Publishing.Navigation.WebNavigationSettings(clientContext, clientContext.Web);
var currentNavigation = webNavigationSetting.CurrentNavigation;
var globalNavigation = webNavigationSetting.GlobalNavigation;
clientContext.ExecuteQuery();
currentNavigation.Source = Microsoft.SharePoint.Client.Publishing.Navigation.StandardNavigationSource.PortalProvider;
clientContext.Web.Update();
clientContext.ExecuteQuery();
}
catch (Exception ex)
{
throw ex;
}
}
}
}
return result;
}
public void ProcessOneWayEvent(SPRemoteEventProperties properties)
{
// This method is not used by app events
}
Any help would be really appreciated!!!