Posts

Showing posts with the label SharePoint Object Model

Tool Part for Visual Web Part – SharePoint 2010

Image
Hi SharePoint Friends,   I would like to discuss some cool stuffs for developing custom “Tool Parts” for SharePoint 2010 Visual web part. “Tool Part” is nothing but the set of controls that are required for your web part which works based on the tool part properties. It will be available as a new section in the web part properties area. There are two ways for developing a Visual Web part with custom tool part 1. Designing the entire tool part using the server side code. 2. Designing the tool part using user controls In this part, I will drive you thru O ption 1 . R u ready, lets get started. Step 1: Create a “Empty Project” using Visual Studio 2010 and name it as “CustomToolpartOtion1” and choose the deployment type as a “Farm Solution” . You should see a similar project structure in VS 2010. Step 2: Open “VisualWebpartwithTP1.cs” file and write the below mentioned code. The above mentioned code is to declare a property which has to be rendered in the web part pr...

Problems while uploading files to SharePoint

Hi guys,             It’s been a while blogging about SharePoint. Have anyone experienced the difficulties in uploading files apart from the characters mentioned in SharePoint. I have experienced the unique thing that when I tried to migrate the documents from Humming Bird to MOSS 2007. SharePoint does not allow consecutive dots in the filename. “..” is not allowed in MOSS 2007, but “. .” is allowed and that’s something weird. One more thing I would like to share is if anyone trying to upload the documents via object model, it’s better to remove the space at the end of the file name. SharePoint allows us to upload the file with the spaces at the end. But after uploading the files, if any user has changed the metadata or something related to that file SharePoint automatically removes the trailing spaces at the end. If there are any custom properties defined in the file then SharePoint will not allow us to upload the file. It will thro...

Batch Update - SharePoint

Hi Guys, Today i would like to explain you about the batch update process in SharePoint. Batch (Group of items), the meaning is to update a large number of items to the SharePoint list by passing the values as XML elements. Consider if u want to update the list with more than 100 items. In this case if u use foreach it will be very expensive and it suck ur time. Moreover if u use SPListItem.Update() it takes 2.8secs for updating a single item. If u r using ProcessBatchUpdate it takes 30 secs to update to a maximum of 200 - 300 items based on ur requirement. So my suggestion is to use ProcessBatchUpdate for Adding, Updating and Deleting a large number of items from the SharePoint List. Lets see how to perform this command through the SharePoint object model Consider that u r adding items in the list with Title field as a running numbers. This is for example ah First of all u should format the XML file for Inserting, Updating or Deleting the items in list StringBuilder methodBu...

SPGridView Problem - Paging and Grouping

Hi guys, i hope u all enjoyed my previous posts. Here i would like to share some information regarding SPGridView in SharePoint. It is one of the most effective and advanced control in SharePoint. Many of them have used this control and they succeed in their part. As per one of the client requirement i have developed a application page with SPGridview and i have added Paging and Grouping. First i add only the paging with custom paging template it works fine. But, when i try to add the Grouping it throws an Unknown Error. I have searched all over the net and i have found the solution. If anyone has encountered this problem please change the EnableViewState property to false and it will work. Cheers...