Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

How to Show/Hide sharepoint quick launch navigation bar based on SharePoint user Group C# Programmatically

$
0
0

Hi

How can we Show/Hide sharepoint quick launch navigation bar based on SharePoint User Group?

When I am trying to update  SPNavigationNode  by using C# code then I am getting below error stack-

Microsoft.SharePoint.SPException was unhandled by user code
  Message=Updates are currently disallowed on GET requests.  To allow updates on a GET, set the 'AllowUnsafeUpdates' property on SPWeb.
  Source=Microsoft.SharePoint
  ErrorCode=-2130243945
  NativeErrorMessage=FAILED hr detected (hr = 0x80004005)

  NativeStackTrace=""
  StackTrace:
       at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)
       at Microsoft.SharePoint.Library.SPRequest.UpdateNavigationNode(String bstrUrl, Int32 lNodeId, DateTime dateParented, String bstrName, String bstrNodeUrl, Object& pvarProperties, String& pbstrDateModified)
       at Microsoft.SharePoint.Navigation.SPNavigationNode.Update()
       at IPVisualWebPartProject.VisualWebPart1.VisualWebPart1UserControl.<>c__DisplayClass2.<HideNodes>b__0()
       at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2()
       at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
  InnerException: System.Runtime.InteropServices.COMException
       Message=<nativehr>0x80004005</nativehr><nativestack></nativestack>Updates are currently disallowed on GET requests.  To allow updates on a GET, set the 'AllowUnsafeUpdates' property on SPWeb.
       Source=""
       ErrorCode=-2130243945
       StackTrace:
            at Microsoft.SharePoint.Library.SPRequestInternalClass.UpdateNavigationNode(String bstrUrl, Int32 lNodeId, DateTime dateParented, String bstrName, String bstrNodeUrl, Object& pvarProperties, String& pbstrDateModified)
            at Microsoft.SharePoint.Library.SPRequest.UpdateNavigationNode(String bstrUrl, Int32 lNodeId, DateTime dateParented, String bstrName, String bstrNodeUrl, Object& pvarProperties, String& pbstrDateModified)
  

I have added  ospWeb.AllowUnsafeUpdates = true; to our C# code but still getting above error. Could you please help me to resolve this issue.

Thank you.


Viewing all articles
Browse latest Browse all 11571

Trending Articles



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