Posts

Showing posts from 2012

Migrate from MOSS 2007 to SharePoint 2010 - Step by Step

http://salaudeen.blogspot.com/2011/09/migrate-from-moss-2007-to-sharepoint.html

Get data from InfoPath form using Object Model(C#)

The InfoPath forms (.xml) files stored in the following Path Open the site inthe SharePoint desinger, click on All Files folder and list -> Open any xml file   <my:group7>     <my:group8>      <my:ListOfAttendee>Ravi</my:ListOfAttendee>      <my:Organization>Financial Services</my:Organization>     </my:group8>     <my:group8>      <my:ListOfAttendee>Kumar</my:ListOfAttendee>      <my:Organization>IT Department</my:Organization>     </my:group8><my:group8>      <my:ListOfAttendee>Mohan</my:ListOfAttendee>      <my:Organization>HR</my:Organization>     </my:group8>    </my:group7> use the below code: SPFile file = properties.ListItem.File;            if (file == null)                return;            // Get the binary data of the file            byte[] xmlFormData = null;            xmlFormData = file.OpenBinary();            // Load the data into an XPathD

Hide First Tab (Home) in SharePoint 2010 Navigation

Image
You will notice that the Home tab actually is the first node and then has a child UL which represents the rest of the navigation Items. So the approach is to hide the first <li> <a> (display: none) and then simply just use (display:block ) to show the hidden <ul> <li> <a> tags. Here is the CSS you could use to hide just the first node (home) tab in a SharePoint 2010 application: Place Content Editor WebPart  and add the below code <style type="text/css"> .s4-tn li.static > a{ display: none !important; } .s4-tn li.static > ul a{ display: block !important; } </style>

Customization SharePoint 2010 - Ribbon

http://www-kga.csharpcorner.com/tags/Create-Custom-Tab-in-Office-Ribbon

Printing SharePoint WebPart content

Try the following steps. It works for most web parts (i have used this for lists) 1. Start with a web part You start by having a web part with a display of information, such as a list. If you don’t have one already you can start by creating a SharePoint Event List, and then, adding a Calendar web part (remember to choose the Calendar View). 2. Add the Print Button You will be adding a Print Button to the page, by putting the JavaScript below into a Content Editor Web Part. Add a Content Editor Web Part to the page with the web part you want to print. Open its properties and click the Source Code button to add the JavaScript code. Copy the following code directly into the Text Builder box. This code will create a “Print Web Part” button that when clicked, will execute the print action. <center><input type="button" OnClick="javascript:void(PrintWebPart())" value="Print Web Part"></center> <script language="JavaScript"> //Con

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 claims authentica

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 ItemUpdating(SPItemEventProperties

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 &quo

Copying/Moving SharePoint 2010 Designer Workflows

Image
https://blogs.msdn.microsoft.com/momalek/2012/04/22/solved-moving-sharepoint-2010-designer-workflows-between-sites/ In man occasions you would be faced by the need to move workflows you developed using SharePoint designer from one site to another. This might be the case if for example you developed and tested the workflow on a testing environment and now wants to move to the production environment without the need to re-develop the workflow. The steps to perform this is rather simple: Export the workflow to Visio. Edit the VWI archive and delete the configuration file. Import the workflow back to your destination site. So open the SharePoint designer and open the source site. click on the workflows link on the left and then the workflow you want to move. Click on the ribbon on export to Visio button. Now rename the file exported (VWI file) to be a ZIP file and open it with Windows Explorer. You will find a file named “workflow.xoml.wfconfig.xml” Just delete this fil

Emulate User Roles in InfoPath Forms Services to Automatically Switch Views

Image
Many of my SharePoint consulting clients and students express the need to have different users see different views of an InfoPath form. In the InfoPath client, this is easy to handle using the User Roles functionality which has been well-documented elsewhere. Unfortunately, User Roles are not supported by InfoPath Forms Services for your browser-enabled forms. Here is a work-around that I have been using for quite some time that has worked well for me and my clients and students. In this post we'll create a simple InfoPath form with two views: one view for most users and another view for administrators only. When the form loads, it will check to see if the current logged in user is an Administrator for that form and if he is it will display the Admin View to the user. If the user is not an administrator for the form, it will display the User View . Create a Custom List to Store Users and Permission Levels Although SharePoint exposes a number of web services that reveal secur