Monday, October 31, 2011

Copy users from one SharePoint group to another group!

This is one of the question raises from many people who has to copy users from one SharePoint group to another group. There is no direct way you can directly copy users through browser. So, it could be problem to site owners and administrators to add all users again. How to solve these kind problems?

Use the simple option which is available through browser.

    1. Go to Site Settings of the site.
    2. Click on People and Groups.
    3. Go to the group from which you want to copy users.
    4. From the group page, select all users and then from Actions Menu, choose "Email Users" as shown below.
    1. Once you selected "E-Mail Users" then your default email program (Ex: Outlook) will be open with all email addresses.

    1. Select all email addresses and copy them.
    2. Go to SharePoint site and then go to SharePoint group to which you want to add users.
    3. From the toolbar, select "New" and then "Add Users".
    4. From the add users page, paste all email addresses and then click "Check names" icon for validation.
    5. Click OK button to save the changes.

With the process above, we have successfully completed the copying of users from one group to another group.



Friday, October 28, 2011

Hide Ribbon in SharePoint 2010 based on User Security

This is a good idea not showing the ribbon control for the users who will not be able to use it anymore.
The below script work if you want to hide the top navigation for the users who are least privileged or anonymous in SharePoint site and most of the options in ribbon are disabled for them.

1) Open your SharePoint master page

2) Locate this line:

3) Change it to:

4) Now find the end of the “s4-ribbonrow” tag and add following block right after it:

5) Save the new master page and publish it.


Tuesday, October 25, 2011

Update InfoPath 2010 form Programmatically

Recently worked on a requiement on InfoPath 2010 custom form.

  1. User already submitted customized InfoPath form in from library.
  2. Using Upload Control, user have uploaded the documents on Form and not submitted these forms in document library.
  3. We need to generate a URL on existing textbox after getting the document name from this attachment control and concatinte this document name wiht the document library URL for all 400 forms.

Implementation Approach:
I created a customized InfoPath forms and published it to each environment.

  1. User can select the SPSite, SPWeb and Form Library from the dropdown.
  2. Search for all the forms in the library which needs to be fix.
  3. Load these form in a multi select box as a datasource and user can select from the UI to fix the form.

Reference DLLs:
using Microsoft.Office.InfoPath;

using System;
using System.Xml;
using System.Xml.XPath;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using System.IO;
using System.Text;
using System.Collections.Generic;
using System.Web;

Also reference: To handle the attached file operations.
using (SPSite site = new SPSite("Your Site Name"))
using (SPWeb web = site.OpenWeb())
SPList formsLib = web.Lists["Your Form Library Name"];

// TIP: Loading a generic list.

// This loaded as a datasource for the multiselect dropdown.
List mulSelectDropDownValue = new List();

// TIP: XPath Navigator.

XPathNavigator domNav = MainDataSource.CreateNavigator();

if (formsLib != null)
foreach (SPListItem item in formsLib.Items)
SPFile ipForm = item.File;

string fileName = ipForm.Name;

byte[] binFile = ipForm.OpenBinary();

Stream strm = new MemoryStream(binFile);

string fileNameParam = string.Empty;

// TIP: Loading a XML Document to hold the file

XmlDocument xd = new XmlDocument();


string textValuePlanning = string.Empty;

string textValueAccounting = string.Empty;

// TIP: Searching the node name in the XML tree, in my case it’s . “my:DoucmentName_1”

XmlNodeList _listDocName = xd.GetElementsByTagName("my:DoucmentName_1");

foreach (XmlNode _listDoc in _listDocName)


if (_listDoc.InnerText != "")

// TIP: InfoPathAttachment Decoder Class to get the attached file on attachment control in my case.

InfoPathAttachmentDecoder dec = new InfoPathAttachmentDecoder(_listDoc.InnerText.ToString());

string _fileName = dec.Filename;

if (_fileName != "")


// TIP: Actual first node name to write value

XmlNodeList _listAcc = xd.GetElementsByTagName("my:accounting_doc_location");

XmlNodeList _linkAccounting = xd.GetElementsByTagName("my:clicklink");

foreach (XmlNode linkNode in _linkAccounting)
linkNode.InnerText = "Click here to view the file";}
foreach (XmlNode node in _listAcc)

textValueAccounting = node.InnerText.ToString();

if (textValueAccounting.ToString() == "")
{node.InnerText = “Put the value to overwrite…”
}}}} }}

Note: This is not the complete code as implemented, for complete code please mail me on referring this post.

Suneet Sharma

Sunday, October 23, 2011

SharePoint 2010: What is a PassPhrase


Sharepoint 2010 has introduced the new concept of "managed accounts" - basically, it stores the encrypted credentials for whatever service accounts you specify.

Initially, the passphrase is used to encrypt the credentials for storage. When you want to do things such as add a new server to the farm (from the server itself via powershell) you will be prompted for the passphrase instead of for the username/password as in the past.

The whole concept of managed accounts allows the passwords to be changed in AD without having to change the password everywhere the account is used in SharePoint.

Suneet Sharma

Wednesday, October 19, 2011

XSD to XML Conversion Code

Converting a XSD to XML file.....using way.....

private void ReadSchemaFromXmlTextReader(string filename){
// Create the DataSet to read the schema into.
DataSet thisDataSet = new DataSet();
// Create a FileStream object with the file path and name.
System.IO.FileStream myFileStream = new System.IO.FileStream
// Create a new XmlTextReader object with the FileStream.
System.Xml.XmlTextReader myXmlTextReader=
new System.Xml.XmlTextReader(myFileStream);
// Read the schema into the DataSet and close the reader.

private void WriteXmlToFile(DataSet thisDataSet) {
if (thisDataSet == null) { return; }
// Create a file name to write to.
string filename = "myXmlDoc.xml";
// Create the FileStream to write with.
System.IO.FileStream myFileStream = new System.IO.FileStream
(filename, System.IO.FileMode.Create);
// Create an XmlTextWriter with the fileStream.
System.Xml.XmlTextWriter myXmlWriter =
new System.Xml.XmlTextWriter(myFileStream, System.Text.Encoding.Unicode);
// Write to the file with the WriteXml method.


Tuesday, October 18, 2011

Monday, October 17, 2011

Bid or no bid for a SharePoint Project | Assessment Checklist for Sales Team

Prospect Information

1 Do we know (and can we influence) the key decision makers?
2 Is this opportunity aligned with the prospect's business strategy?
3 Has the budget been formally approved and funded?
4 Do we understand the business need or pain driving this bid?
5 Are requirements clearly defined, and are they technically feasible?
6 Do we know the evaluation criteria and how it will be weighted?
7 Are there serious business/technical/financial issues behind the scene?
8 Do we know the proposal time frame, and is it realistic?
9 Has the prospect already made a "buy or build" decision?
10 Is low price a major factor in selecting the winning bid?
11 Are there penalties for not delivering on time or within budget?
12 Are the contract terms and conditions acceptable to us?

Internal Information

13 Is this opportunity in sync with our own strategic direction?
14 Do we have strong management support and sponsorship?
15 Do we have the resources, talent, and will to win this opportunity?
16 Do we have the resources and ability to deliver, if we win?
17 Can we realistically manage the risks, if we win?
18 If additional resources are needed, can we get what we need?
19 How well are we known within this business sector?
20 Do we have a successful track record with similar opportunities?
21 Do we have a relationship with this prospect, and is it favorable?
22 Are partners needed, and if so, will they complicate our situation?
23 Do we have differentiators that improve our odds of winning?
24 Can we afford the investment needed to pursue this opportunity?
25 Will winning put any of our existing business at risk?
26 Can we contractually protect our intellectual property?
27 Are there consequences to us of losing or not bidding?

Market/Competitive Information

28 Do we know who the other competitive bidders are, if any?
29Is a competitor an incumbent, and does that pose a threat?
30 Is a competitor favored by prospect decision makers or influencers?
31Are we at a distinct competitive disadvantage from the start?
32 Does this solution involve new or unproven technologies?
33 Will winning enhance our reputation and market positioning?
34 Will winning open up new market opportunities for us?
35 Will winning give us an advantage over our competitors?


Thursday, October 13, 2011

SharePoint 2007 to SharePoint 2010 Migration Part 1

SharePoint 2007 to SharePoint 2010 Migration Part 1

SharePoint 2007 to 2010 migration using the MetaLogix Migration Manager.

Wednesday, October 12, 2011

SPSite Vs SPWeb and SPWebApplication – What they represent in SharePoint Server Object Model

SPSite Vs SPWeb and SPWebApplication – What they represent in SharePoint Server Object Model:

Simply Explained:

A SharePoint Web application (SPWebApplication) is web site inside Ineternet Information server, A web application can have multiple sites , a Site (SpSite) is a collection a single top level site (SPWeb) and group of sites (SPWebCollection) and sub sites.

Lets see the Code Way: In this example we will code from top to bottom in the object model....with some coding samples...

String hierarchy="";//Read web application collection

SPWebApplicationCollection webApplicationCol =


Tip: SPWebService is a container for the SPWebApplications.

foreach (SPWebApplication webApp in webApplicationCol){
//Fetch the Web application name

hierarchy += "Web Application Name (SPWebApplication):" + webApp.Name + "\r\n";

//Looping for all SPSites under each web app.
for (int i = 0; i < webApp.Sites.Count; i++){
SPSite site = webApp.Sites[i];

//Site collection URL

hierarchy += "Site Collection URL(SPSite):" + site.Url + "\r\n";
for (int j = 0; j < site.AllWebs.Count; j++)
SPWeb web = site.AllWebs[j];
for (int k = 0; k < web.Webs.Count;k++ )
SPWeb web1 = web.Webs[k];

//top level site and subsites

URLhierarchy += "Sub Site URL(SPWeb):" + web1.Url + "\r\n";}



hierarchy += "----------------------------------------------" + "\r\n";

To get a reference to the current top-level server farm object -
SPFarm myFarm = SPContext.Current.Site.WebApplication.Farm;

To get a reference to the site collection database -
SPSite oSiteCollection = SPContext.Current.Site.CurrentDatabase

To return the collection of site collections in a SharePoint Web application -
SPWebApplication webApplication = SPContext.Current.Site.WebApplication;
using (SPSiteCollection siteCollections = webApplication.Sites){
foreach (SPSite siteCollection in siteCollections){Label1.Text += siteCollection.Url + “

TIP : To run the above code reference the Microsoft.SharePoint.Administration.SPWebApplication assembly in your code.

To return the collection of the all the Webs or sites within a site collection, including the top-level site and all sub sites.
SPSite oSiteCollection = SPContext.Current.Site;

TIP: SPContext class is used to return context information about the current Web application, site collection, site, list, or a list item.

using (SPWebCollection collWebsite = oSiteCollection.AllWebs);
for (int i = 0; i < collWebsite.Count; i++)


using (SPWeb oWebsite = collWebsite[i])

SPListCollection collList = oWebsite.Lists;

for (int j = 0; j < collList.Count; j++)
Label1.Text += SPEncode.HtmlEncode(collWebsite[i].Title) + ” ”+ SPEncode.HtmlEncode(collList[j].Title) + “

To return the all the subsites and lists of the current site

using (SPWeb oWebSite = mySiteCollection.OpenWeb())
using (SPWebCollection subSites = oWebsite.Webs)
foreach (SPWeb subSite in subSites){Label1.Text += SPEncode.HtmlEncode(subSite.Title) + “
SPListCollection collList = subSite.Lists;
foreach (SPList oList in collList){Label1.Text += SPEncode.HtmlEncode(oList.Title) + ” ” +oList.ItemCount.ToString() + “
TIP:1. SPEncode: class provides methods for encoding strings. (HtmlDecode, HtmlEncode, HtmlEncodePreserveSpaces, IsLegalCharInUrl , NoEncode,etc.. )
2. HtmlEncode: Encodes the specified string so that special characters used in HTML are encoded as HTML entities.
  • < to <
  • > to >
  • & to &
  • " to "
  • ' to '

Tuesday, October 11, 2011

Why people don't click on Google ads below?

Monday, October 10, 2011

Frustated with Window prompt again and again in SharePoint 2010

Frustated with Window prompt again and again in SharePoint 2010. Always pop-up when you hit the URL.

Get rid of these simple steps.
Addressing you window prompt issue, please follow the following steps and let us know if it works for you.

1. Click Start, and then click Control Panel.

2. Open the User Accounts dialog box. Go to Advanced > Manage Passwords

3. Open the Stored User Names and Passwords dialog box by clicking on the Manage my network passwords button

4. Click the Add button and type your SharePoint URL (without HTTP), user name, and password, for example:

5. Click OK

Now you should be able to access your SharePoint resources without being prompted for credentials since Windows will handle that for you automatically.

If you change your password, you will have to change it here as well.

Note: If you still face the same problem doing all these steps, re-start your machine once.


- Suneet

Thursday, October 6, 2011

SharePoint 2010 Designer: Workflow Impersonation.. heard correct....

As you might know that for security reasons, a SharePoint designer workflow always runs under the permissions of the user who started the workflow. So how would you perform actions that the workflow initiator does not have access to ? Well, in SharePoint designer 2010 microsoft has introducted a concept called impersonation steps where a sections of the workflow can be run under the identity of the person who authored the workflow rather than by the workflow’s initiator. Thus Impersonating the Steps or actions.
Again, Please note : Impersonation steps run with the permissions of the person who last saved the workflow– typically the workflow template author.
So, When would you impersonate the workflow steps. I have listed some of the scenarios
1. Moving a document from the current library to an archiving library to which the initiator only has read permissions.2. Granting permissions to users – IF in workflow you need to use “Add User to Group” action3. Create a list

What actions can be impersonated – Well here is the list
* Set Content Approval Status (as Owner)
* Create List Item (as Owner)
* Update List Item (as Owner)
* Delete List Item (as Owner)
* Add/Remove/Set/Inherit List Item Permissions (as Owner)
How Do I start with Impersonation – You can create a User-Impersonation Step type step which can then run the sections(under the step) of your workflow under the permissions of the person who authored the workflow. For e.g. In the below steps, if the item is approved, it will be moved to the archive list under authors permissions.

The User-Impersonation type step does have some additional conditions available for efficiently implementing impersonation. Lets look at two major conditions that you would need to implement impersonation -
1. Check list item permissions - The condition simply says the below :
If permissions for these users are at least these permissions on item in this list.
The usage : If permissions for WFApprovers Members are at least Read on item in Current Items

For the above condition to evaluate as true, the users must have at least the permissions that the Read Permission levels provide. This step can very well be used to check that the WFApprovers should have read access to the items.

2. Check list item permission levels - The condition simply says the below :
If permission levels for these users are at least these permission levels on item in this list.
The usage : If permission levels for ikapoor Members are at least Read on item in Current Items.
Please note that : The users can be a single user, multiple users, but you cannot use a group in this condition.
Important Things to remember Notes : Impersonation steps can only be added to the root of a workflow and cannot be nested in another step.


PowerUser's experience Survey...with SharePoint.. interesting....

Still don't know something about it?

Don't know how to use it? ....lost?

See this presentation:


Tuesday, October 4, 2011

SharePoint 2010 with JQuery: Show your list data on Home Page

I got a requirement from my previous client as he was not happy the way OOB list and libraries are show the data on home page and he wanted to show this in a better way....and he asked me how we can achieve it....
Some ideas like:
1. New XSLTWeb Part using SharePoint designer...where formatting is possible...and even you can use change the look and feel of the page....
2. Use JQuery to show dynamic data using the SOAP Web Service...and JQuery JavaScript files...and believe me...i got the second option working for him..and implemented a ticker
with that....
How it works:

For complete script, please visit on my facebook group:(Not able to put script here....some problem)!/groups/278184828858587/doc/290597774283959/



SharePoint 2010 : Hide left navigation wiht CSS

Small script to hide the left navigation from a SharePoint Page...or entier site collection...see how it works.....

On your page, add a content editor web part...and paste this script in there.....and done.

For complete script:!/groups/278184828858587/doc/290595817617488/

If you put the script in master page the the entire site collection's left navigation will not work if you have attached the master page or master page is set the default master better idea is to keep it in Content editor web part on page only.



Monday, October 3, 2011

SHAREPOINT\System account ........SharePoint 2010.

Lots of time we see in Document libraries, lists data user name under modified by column name comes for sharepoint\system account. So who's this hidden user and what this does in SharePoint??
  • SHAREPOINT\Systemaccount is the same account used by application pool of your SharePoint web application in IIS at the time of creation/extension of respective web application.
  • This is the account which is used when you run your code in under elevated privileges by SPSecurity.RunWithElevatedPrivileges.
  • When you create/extend a web application in SharePoint and specify an Application Pool then the identity (Network Account) used by that Application pool becomes the SHAREPOINT\System account.
  • It is highly recommended that end user should not be allowed to use this account to avoid unexpected errors.
  • If you change the identity of App Pool account after creating/extending the SharePoint web application, the new account will notbecome the SHAREPOINT\System.


Saturday, October 1, 2011

Path to become SharePoint Architect....MicroSoft recommendations...

Wanna be a SharePoint architect....learn these topics and implement when working with a client..
Must Understand the Core:
  • IIS 6/7
  • Windows Server 2003/2008
  • DNS/WINS (Name Resolution)
  • TCP/IP & other network considerations
  • SQL Server 2005 Advanced Administration (Backup, Monitoring, Logshipping or Database Mirroring)
  • Basic Firewall rules and Proxy
  • IT Infrastructure Design
  • Hardware Acquisition (RAM, CPU, Disk I/O, and other hardware considerations)
  • Performance Monitoring
  • Capacity Planning
  • Growth Management
  • Workflow (Windows Workflow Foundation)
  • Client Troubleshooting & Support: IE, Firefox, Safari, Office XP, 2003, 2007, etc...
  • HTML & Client side scripting (Javascript, AJAX, DHTML, XSL, XSLT, XHTML)
  • Exchange and SMTP integration (Inbound and Outbound email including contact objects)
  • High Availability: Microsoft Cluster Services, Windows Network Load Balancing
  • Storage: Appliances, HBAs, SANs, Archive Storage
  • Backup Solutions: Various Tape, Hardware and software snapshots, software nearline and offline storage (soon to add DPM 2007)
  • Hardware load balancing, ISA Secure Web Publishing
  • IAG (Internet Application Gateway) Whale Communications
  • Single Sign on integration
  • Connection Monitoring & Troubleshooting (ADO.NET, Web Services, CDO)
  • Global Deployments - Multi farm deployments
  • Dev, Test, Staging, Production - Staged deployments
  • MOF, ITIL, MSF Frameworks and strong understanding of the development life cycle
  • Virtualization - Virtual Server 2005, Virtual PC, VMWare
  • Internet Publishing
  • Internet Community Portal
  • Intranet Central Search Portal
  • Intranet Departmental Dashboard Portal
  • Intranet Collaboration
  • Business Process Management
  • Extranet Collaboration
  • Document Management
  • Records repository
  • BI Solutions
  • Search Center or Intranet and Internet Search Solutions
  • Reports Center
  • Mobile Solutions
  • Remote employee solutions
  • Multi lingual solutions
  • Project Server
  • Web 2.0 Solution: Blogs, Wikis, Social Networking (Profiles & My Sites)
  • AD (Group Policies, Security Groups, DLs, Contacts, authentication, and attributes for profile import)
  • Desktop Management (IE settings, Office deployment, storage and collaboration considerations)
  • MOM Systems Center Operations Monitoring of performance and system health of servers and dependencies
  • WAN and Network performance testing and considerations, (minimum performance levels) caching
  • File Services & (extremely light... policy SMS and Patching considerations)
  • Antivirus management solutions like Forefront
  • Presence Integration (LCS, Office Live Communication Server, SMTP and SIP)
  • Understanding and supporting Dev: ASP.NET, C#, Assemblies, GAC, Bin, web.config, web parts, web part connections, missing assemblies
  • MIIS in cross forest or resource forest scenarios or dynamic security groups
  • Migration Skills: Public Folders, Documentum, Lotus Notes, CMS, WebSphere
Interop and Integration
  • Office Interoperability (Word, Excel, Access, PowerPoint, Outlook)
  • Project Server deployment
  • Microsoft Dynamics (CRM, ERP, AXAPTA, GreatPlains, etc...)
  • Infopath forms troubleshooting and basic design skills (XML, HTML)
  • Visio integration
  • Biztalk
  • SharePoint Designer for workflows, CSS, Design, etc...
  • Reporting and Analysis Integration: SQL Reporting Services, SQL Analysis Services
  • SAP integration with Duet
  • BDC Siebel web services integration
  • Oracle Financials integration in BDC and Excel Services
  • Other ADO.NET BDC connections: includes various CRM, ERP, DBMS
  • Commerce integration in Internet sites
  • Web Services integration
  • Documentum, WebSphere
  • Search/Indexing Integration
  • Data warehouses RDBMS
  • Single Sign on solutions and integration with client certificates, smart cards, and 2 factor auth
  • N tiered web apps, web services, and stores
  • Samba and NFS?" id="Player_9d099a9a-5d56-4481-acc0-8560994515c7"  WIDTH="600px" HEIGHT="200px">"> NAME="quality" VALUE="high">" id="Player_9d099a9a-5d56-4481-acc0-8560994515c7" quality="high" bgcolor="#ffffff" name="Player_9d099a9a-5d56-4481-acc0-8560994515c7" allowscriptaccess="always"  type="application/x-shockwave-flash" align="middle" height="200px" width="600px">