Posts

Programmatically generate/update data for an InfoPath Form and save it in a SharePoint Form Library

Steps  1) Create an Infopath form using the Microsoft InfoPath desinger. and publish the infoPath form into respective form library. I also created an empty form in the form library based on this template (BLANK.xml). This example opens an empty form (BLANK.xml) from the form library, reads it into an xml document, parses the xml document to update the fields, and then saves the xml document as a new file back to the form library. 2) // opens the site SPWeb webSite = new SPSite(txtUrl.Text).OpenWeb(); // gets the blank file to copy SPFile BLANK = webSite.Folders["Test1"].Files["BLANK.xml"]; // reads the blank file into an xml document MemoryStream inStream = new MemoryStream(BLANK.OpenBinary()); XmlTextReader reader = new XmlTextReader(inStream); XmlDocument xd = new XmlDocument(); xd.Load(reader); reader.Close(); inStream.Close(); //gets the root element from the xml document XmlElement root = xd.DocumentElement; //the loop counter is started at 2 to skip ...

Show/hide Two WebParts based on usergroups in Landing page

Image
1) Create custom Document Library (ex: Pages) break the permissions and assign NT authenticated Users as read permissions 2) Create Web Part Page on SharePoint site 2)       Give proper name for Landing Page(ex: Default.aspx) and select the "Pages" from Document Library dropdown 3) Add 2 Content Editor WebParts on created page 4) Assign the groups to First Content Editor WebPart as Taget Audience 5) In content Editor HTML source, add the id to DIV tag (ex: <div id=" authenticatedContent "> we need to use this id in second content editor webpart script file for verifying length) 6) Open the Second Content Editor WebPart HTML Source and add the below script <div id="noaccessmsg"></div> <script language="javascript" src="/root/root/SiteAssets/js/jquery-1.7.2.min.js"></script><script type="text/javascript"> if ($("#authenticatedContent").length == 0){      ...

How to Configure Form Based Authentication (FBA) in SharePoint 2010

Image
I found good article(step by step) on Internet and posting here ........enjoy :) Introduction This article explains step by step information on configuring Form Based Authentication (FBA) in SharePoint 2010. This article would be useful for developers/designers/architects and those who want to implement form based authentication (FBA) for their SharePoint 2010 sites as a business requirement. We cannot use the classic / basic claimed based authentication for all business scenarios. I was recently working on a consumer portal or product selling site where form based authentication is most appropriate. This article resolves authentication issues by configuring a SharePoint 2010 site with form based authentication. Difference between MOSS 2007 and SharePoint 2010 There is no huge difference in configuring FBA for a MOSS 2007 site and a SharePoint 2010 site. You cannot implement FBA for a SharePoint 2010 class authentication site. FBA can be implemented only for a cla...

BeforeProperties/AfterProperties in Event Receivers

As many of you know, event receivers are a great way to hook into various SharePoint events.  These can apply to Feature events such as FeatureActivated, List events such as FieldAdded, and many others.  The most common set of receivers used, however, are part of SPItemEventReceiver which let you wire your code up to a number of events that can occur to items on a list or library. When working with events, you’ll quickly find that before (synchronous) and after (asynchronous) events exist, and the method suffix such as “ing” (e.g. ItemAdding) and “ed” (e.g. ItemAdded) will tell you whether it gets invoked before or after the actual change is made.  Basic stuff. And, as you get deeper, you’ll even find that you can extract the before and after state of the change.  For example, you can hook into the ItemUpdating event for a document library and prevent a user from changing a certain column.  The code might look like this: public override void ItemUpdatin...

Create a Search Scope for a Sharepoint 2010 List or Library

Image
Update: I’ve just recorded a screencast tutorial on creating a search scope: click here Go to Site Actions > Site Settings (make sure you’re in the root site), and click “Search scopes”. Click “New Scope” to create a new scope to load in a sub-page of the site. Nothing really needs to be set on this screen except the title. If you want this to be a default scope that shows in the normal scope dropdown, make sure and select the “Search Dropdown” box. Otherwise, everything can be set in your custom page. In the next screen you’ll see your newly created scope under “Unused Scopes”. There are no rules attached to this scope yet, so let’s go create some. Click “Add rules”. If you want this search scope to query a specific list (for instance, I wanted it to troll through the “newlist” list), enter the address of the list in the “folder” textbox. Also, if you check “require” it will designate that only this list will be searched. I’m not exactly sure how often the scopes update, but it s...

SharePoint 2007 Page Life Cycle

User request the SharePoint Page using http ASP.NET calls the WSS File provider WSS file provider returns the page from File or Database Page is parsed by SafeMode parsor if required Returned page is complied by ASP.NET Compiler WSS File provider collects the page layout class and complies it ASP.NET engine adds SharePoint Context Data to the site meta data and retreives the associated master page. Master page got compiled and responded back to the user.

ASP.NET Page Life Cycle

Image
ASP.NET Page Life Cycle  When an ASP.NET page runs, the page goes through a life cycle in which it performs a series of processing steps. These include initialization, instantiating controls, restoring and maintaining state, running event handler code, and rendering. It is important for you to understand the page life cycle. General Page Life-cycle Stages (Courtsy MSDN, CP, UsualDosage, Several Blogs...) In general terms, the page goes through the stages outlined in the following table. In addition to the page life-cycle stages, there are application stages that occur before and after a request but are not specific to a page. Putting together an acronym for the page life cycle is easy enough. Since the Page Request technically isn't a part of the life cycle (it only indicates whether we actually will start the cycle or load a cached page) we won't include it in the acronym. S � Start I � Initialize L � Load V � Validate E � Event Handling R � Render That gives us ...