Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

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
share|improve this answer

clientContext.Web.Update();

TaxonomySession taxSession = TaxonomySession.GetTaxonomySession(clientContext)
webNavigationSetting.Update(taxSession);
share|improve this answer
1  
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 '13 at 20:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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