Skip to main content

Posts

Showing posts with the label SharePoint 2007

Setting WebPartLimits Attributes

One of my team member was face an issue regarding the web parts on a page i.e." The maximum number of Web Parts for all zones on this page has been exceeded ". After analysis I found on that page there are 60+ web parts on that page. I am sharing the quick solution with you. Resolution To resolve this issue you have to set the Web Part limit in application web.config. file. There are two Web Part limit attributes: · MaxZoneParts specifies the total number of Web Parts allowed within all Web Part zones on a Web Part Page. · PropertySize specifies the maximum number of bytes used to store Web Part properties on the server. The following example sets the Web Part limit attributes <SharePoint>     <WebPartLimits MaxZoneParts=" 50 " PropertySize=" 1048576 " /> </SharePoint> You just have to update the MaxZoneParts value to web parts count availabe on your page or exceed and update the PropertySize value. ...

The site with the id {GUID} could not be found.

While answering to MSDN forums, many peoples have issue FileNotFoundException: The site with the id {GUID} could not be found.  File is present on same location and error comes file not found. This was due to BLOB cache problem. I also faced the same problem here I am sharing the solution for you. Resolution Open the site in web browser, click Site Actions->Site Settings->Modify All Site Settings->Site Collection Object Cache. Checked all three check boxes here and click OK.

Programmatically add Javascript or CSS to pages in SandBox web part

When you are creating a farm solution , it is easy to include javascript files into site pages using a CustomAction. You can add the JavaScript file to _layouts folder and use as: < CustomAction Location = "ScriptLink" ScriptSrc = "/_layouts/.../your_javascript_file.js" Sequence = "100" > The problem is, in sandboxed solutions you are not allowed to deploy files to the file system (_layouts), and it is not possible to reference Assets files. I'd recommend you to use native SharePoint controls: CssRegistration and ScriptLink Example protected override void CreateChildControls() {      base.CreateChildControls();      this .Controls.Add( new ScriptLink()      {          Name = "/_layouts/MyFolder/MyScript.js" ,          Language  = "javascript" ,          Locali...

Hiding SharePoint List and Library Menus

You can hide the sharepoint list and library action menus by javascript. You will find and hide the Explorer View menu: <script language= "JavaScript" > var doc = document.getElementsByTagName( 'ie:menuitem' ); for ( var i = 0; i < doc.length; i++) { itm = doc[i]; if (itm.id.match( 'OpenInExplorer' )!= null ) { itm.hidden= true ; } } </script> The trick here is to find the menu tags on the page. What we are looking for is this: <ie:menuitem id="zz23_OpenInExplorer" ... hidden= ... /> The JavaScript starts by finding all tags named "ie:menuitem" and then looping through those to find the one we need. The hidden attribute is pretty obvious, so we set it to false. For just one library: Where do you put this JavaScript? For just one library use SharePoint Designer add this to the bottom of the allitems.aspx for that library. The best place is just bef...

Prevent Recursive Event Handler

One of the problems I had with list event handlers was event recursion. I wrote an event handler to handle updating items. I wanted to check some values, and then set a value in a field based on a set of rules. The problem was- when I set the value of the field and updated the item, the ItemUpdated and ItemUpdating events fired up again, and again my code updated the item and so on and so on. I also wanted to avoid having the list item change version number following my code-update. that update was supposed to be part of the version that the user just created by updating. Otherwise, every user update of the list item would bump the version number twice! Similarly, I didn't want the code to show that an administrator changed the item. I wanted it to look as if the user did the change to that field. So after some research, here is my solution:   item[fieldnamehere] = fieldvaluehere; this.DisableEventFiriing(); item.SystemUpdate(false); this.EnableEventFiring(); ...

Create Custom Permission level in SharePoint

I am writing the complete steps to create custom permission level in SharePoint 2010/2007. In my listed example, I am creating a custom permission level having all contribute writes rather then delete. It means the user having this permission can have all contribute rights but not able to delete data, user can Add, View or update the data in SharePoint Lists/libraries. 1-      On the Site Actions menu, click Site Settings . 2-      On the Site Settings page, under Users and Permissions, click Advanced permissions 3-      On the Settings menu, click Permission Levels 4-      Click Contribute 5-      Click Copy Permission Level button from bottom of page 6-      On Next Page, give appropriate Name and Description (e.g. Contribute without delete) 7-      Click Create Button at the bottom of current page. 8-      The new...