Wednesday, February 24, 2010

Access Denied when callign SPService.Update()

Problem:
Access Denied when callign SPService.Update().
This error was not seen in MOSS 2007, however now when deployed to SharePoint 2010 we are seeing this error when the code reaches SPService.Update() i.e. base.update();

Details:
There is a Web service AppWebService deployed to SharePoint 2010 & it consumes OneOfMyServices: SPService, IBackupRestore to store/persist a XML file.

Lines of code


SPSecurity.RunWithElevatedPrivileges(delegate()

{




base.Update(); //Errors out here with Access Denied

});

Exception details



Source
"Microsoft.SharePoint"

Stack Trace: at Microsoft.SharePoint.Administration.SPPersistedObject.BaseUpdate()
at MY.APPServices.Services.OneOfMyServices.b__1()
at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.b__2()
at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)

{Void BaseUpdate()}
System.Reflection.MethodAttributes.Private | System.Reflection.MethodAttributes.FamANDAssem | System.Reflection.MethodAttributes.HideBySig

Declarign Type = {Name = "SPPersistedObject" FullName = "Microsoft.SharePoint.Administration.SPPersistedObject"}

OS - Windows 7 ultimate
SharePoint 2010 beta

if any one has seen this or was able to resolve kindly reply with possible directions, resolution ....

Sunday, February 7, 2010

Left Navigation & Webpart Pages

Sharepoint 2010 webpart pages dont show the left navigation by default

http://jetlounge.net/blogs/teched/archive/2009/01/12/quick-launch-bar-navigation-missing-from-web-part-pages-in-sharepoint.aspx

http://www.beyondweblogs.com/post/Quick-Launch-Navigation-missing-from-SharePoint-Web-part-page.aspx
Solution provided in these link didn't work however some research & persistence did it all - we found the solution-
1. There is this tag which needs to be deleted or commented (this one hides the left nav)
<SharePoint:UIVersionedContent ID="WebPartPageHideQLStyles" UIVersion="4" runat="server">
<contenttemplate>
<style type="text/css">
body #s4-leftpanel {
display:none;
}
.s4-ca {
margin-left:0px;
}
</style>
</ContentTemplate>
</SharePoint:UIVersionedContent>

2. Delete only this tag as this is what overrides the default nav coming from the master page.
<asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server"></asp:Content>
3. Leave this tag as it is, if this is deleted(as said in other posts) it leaves a blank row on top the left nav which is not what you would want.
<asp:Content ContentPlaceHolderId="PlaceHolderNavSpacer" runat="server"></asp:Content>

Happy SharePointing!