Archive for March, 2012

Connect webparts programmatically using SPConnectWebParts


If you wish to connect two webpart where you have webpart consumer and webpart provider object then you can use following idea to implement functionality. /// <summary> /// It connect web parts each others, if any, using consumer and provider objects /// siteWebParts object have all information like consumer,provider connection and mapping. /// You can […]

March 13, 2012 · Infoyen · No Comments
Tags: , , , , , , , ,  · Posted in: MOSS, SharePoint

Export and import webparts programmatically


Requirement:- I have 1 site Where it has sharepoint page’s with some webparts. Due to business requirement; we need to export these webpart and import on other site page programmatically. Therefore I created a tool which first exports webparts (.webpart file) and metadata in xml format, then import web part on other site using xml […]

March 13, 2012 · Infoyen · 4 Comments
Tags: , , , , , , , , , ,  · Posted in: MOSS, SharePoint

Pass page values from one to another page in ASP .NET


Hi, To Pass Values Between ASP.NET Web Pages or To Transfer page values to another page we can use following:- 1. Response.Redirect (Use a query string.) 2. Cookies 3. Session Variables 4. Application Variables 5. HttpContext by using Server.Transfer details:- Introduction We always come into situations in which we need to transfer values from one […]

March 13, 2012 · Infoyen · No Comments
Tags: , , ,  · Posted in: ASP .NET

This page contains content or formatting that is not valid. You can find more information in the affected sections


You get this error when you are trying to update a SharePoint webpart tool part or something like that and you click on ‘Publish’ page button. This only happens if you have any Validation Controls on your webpart. Solution: As you have validation controls on your webpart UI and you are not filling in anything, […]

March 13, 2012 · Infoyen · No Comments
Tags: , ,  · Posted in: MOSS, SharePoint

SharePoint custom Master Page Do Not Print


Issue: When using Microsoft custom Master Pages, print preview pages dont show any content in the body of the page. Reason: Sharepoint use core.css file in which they write few classes where they says that this class should not be use for print/media. Solution:- While customizing make sure not to use those classes on top […]

March 12, 2012 · Infoyen · No Comments
Tags: , , , , ,  · Posted in: Branding, MOSS, SharePoint

Retrieve Web part Title in Contentquerymain.xsl


To retrieve webpart title in Contentquerymain.xsl, You can use Feed Title web part property. To achieve this you need to add <xsl:param name=”FeedTitle” /> to your custom ContentQueryMain.xsl in the params section. Doing this the param FeedTitle will contain the web part Title and can be used inside xsl as below code <xsl:value-of select=”$FeedTitle” /> […]

March 12, 2012 · Infoyen · 7 Comments
Tags: , , , ,  · Posted in: CQWP, MOSS, SharePoint

Creating a List programmatically using the sharepoint object model


You can create a list by picking one of the List Template Types available in the SPListTemplateType object. Guid listId = web.Lists.Add(“List Name”, “Description”, SPListTemplateType.GenericList); SPList list = web.Lists[listId]; Reference: http://msdn.microsoft.com/en-us/library/ms425818.aspx http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splisttemplatetype.aspx Thanks! Avinash

March 12, 2012 · Infoyen · No Comments
Tags: , ,  · Posted in: List, MOSS, SharePoint

Programmatically adding items to a SharePoint list


using(SPSite site = new SPSite(“http://”)) { using (SPWeb web = site.OpenWeb()) { SPList list = web.Lists[“SharePointList”]; // you can use web.GetList method which is better for performance. SPListItem Item = list.Items.Add(); item[“Title”] = txtCompanyName.Text; // the text which need to update //can add required items  item.Update(); } } Note: 1. No need to use SPSecurity.RunWithElevatedPrivileges. […]

March 12, 2012 · Infoyen · One Comment
Tags: , , , ,  · Posted in: List, MOSS, SharePoint

Document Icon in CQWP


Description This article will show you how to display icon in Content Query Web Part (CQWP). Requirement:- In several requirements we use existing CQWP and modify XSLT to make required view. In one of requirement i asked to display icon of uploaded document. I found the very simple solution for which detail is described further […]

March 12, 2012 · Infoyen · No Comments
Tags: , , , ,  · Posted in: CQWP, MOSS, SharePoint

Error 5337 when Submitting Data from InfoPath 2007 to a SharePoint List


There might be two reasons:- 1. security issue In infopath editor, Go to form option, set full trust and create trusted certificate. That should make it work. 2. If you are using RunWithElevatedPrivilages or updating list This happens mostly when you call SPListItem.Update inside the RunWithElevatedPrivileges block. So you should •Declare your SPWeb object outside […]

March 9, 2012 · Infoyen · No Comments
Tags: , , ,  · Posted in: InfoPath 2007, List, MOSS, SharePoint


myworldmaps infoyen