1

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!!!

2 Answers 2

1

I had the same problem. My app was running on Azure. In my case the libraries

Microsoft.SharePoint.Client.Publishing.dll

Microsoft.SharePoint.Client.Taxonomy.dll

ware not uploaded to the Azure. After uploading them manually via FTP manager, the issue was resolved

Brian's Answer is also relevant. You do need to update your publishing web in order to make changes

    TaxonomySession taxSession = TaxonomySession.GetTaxonomySession(clientContext)
    webNavigationSetting.Update(taxSession);

You do not need to update the current Web because you did not make any changes to it:

    clientContext.Web.Update(); // you do not need this in the current example
0

clientContext.Web.Update();

TaxonomySession taxSession = TaxonomySession.GetTaxonomySession(clientContext)
webNavigationSetting.Update(taxSession);
1
  • 2
    Would you please add a few words of explanation to your answer? Just posting some code does not help much with understanding what the issue and the solution is.
    – teylyn
    Aug 8, 2013 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.