Friday, August 5, 2011

Save values from peopleEditor control to Sharepoint List


Microsoft.SharePoint.WebControls.PeopleEditor
<SharePoint:PeopleEditor ID="myPeoplePicker" runat="server" Width="300" BorderStyle="Solid" BorderColor="Black"BorderWidth="1" />


            SPSite site = SPContext.Current.Site;
            SPListItem items = null;
            using (SPWeb web = Site.OpenWeb())
            {
                SPList list = web.Lists["Users"];
                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    items = list.Items.Add();
                });
                items["FirstName"] = txtFirstName.Text;
                items["LastName"] = txtLastName.Text;
                items["Email"] = txtEmail.Text;
                items["Date Of Join"] = txtDOJ.Text;
                items["Sex"] = drpGender.SelectedValue;

                SPFieldUserValueCollection values = new SPFieldUserValueCollection();              
                foreach (PickerEntity entity in myPeoplePicker.ResolvedEntities)
                {
                    SPFieldUserValue fuv = new SPFieldUserValue(SPContext.Current.Web, Convert.ToInt16(entity.EntityData[PeopleEditorEntityDataKeys.UserId]), entity.Description);
                    values.Add(fuv);
                }

                string managers = myPeoplePicker.CommaSeparatedAccounts;
                char[] splitter = { ',' };
                string[] splitPPData = managers.Split(splitter);
                SPFieldUserValueCollection myvalues = new SPFieldUserValueCollection();
                for (int i = 0; i < splitPPData.Length; i++)
                {
                    string loginName = splitPPData[i];
                    if (!string.IsNullOrEmpty(loginName))
                    {
                        SPUser user = web.SiteUsers[loginName];
                        SPFieldUserValue fuv = new SPFieldUserValue(web, user.ID, user.LoginName);
                        myvalues.Add(fuv);
                    }
                }
                /*
                string Assigned = ((Microsoft.SharePoint.WebControls.PickerEntity)(myPeoplePicker.Entities[0])).Key;
                Assigned = Assigned.Remove(Assigned.IndexOf(';'));
                int UserID = Convert.ToInt32(Assigned);
                items["User"] = web.SiteUsers.GetByID(UserID).LoginName;*/

                items["User"] = myvalues;

                items["Marital Status"] = drpMaritalStatus.SelectedValue;
                items["CL"] = 8;
                items["PL"] = 4;
                items["LOP"] = 0;
                items["LastUpdateOn"] = DateTime.Now;
                items.Update();
            }


http://www.sswug.org/articles/viewarticle.aspx?id=43246

Thursday, August 4, 2011

Runtime Error -- Custom Pages

To View Real Error Description in SharePoint 2010:

Open the web.config (“C:\inetpub\wwwroot\wss\VirtualDirectories\<port>”) and set:
1. Debug=”true” instead of the default of Debug=”false”
2. CallStack=”true” instead of the default of CallStack=”false”
3. CustomErrors=”Off” instead of the default of CustomErrors=”On”

Open other web.config (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\web.config) and set:
1. CustomErrors=”Off”

Friday, July 22, 2011

SharePoint list column hide

List column hide:

http://littletalk.wordpress.com/2009/03/30/hide-remove-title-column-from-sharepoint-list/

Steps:
1. Select tasks
2. Select list from list tools at the top of the link
3. select list settings
4. select task or work flow task from content type
5. select the column

6. set the column setting
7. select the 3 rd option as "Hidden(will not appear in forms)"

Wednesday, July 20, 2011

Info Path Form & Form Library

Publish Info Path to sharepoint Form Library:
http://www.youtube.com/watch?v=voxmM9Vz7qU&feature=related
c:\program files\common files\Microsoft Shared\Web Server Extensions\14\bin\stsadm -o installfeature -name IPFSAdminWeb


Bind SharePoint list data to Info path control:
http://www.youtube.com/watch?v=6NySzgGhnaw

creating and publishing Infopath forms in Share Point 2010:

http://www.dotnetspark.com/kb/2678-creating-and-publishing-document-based-infopath.aspx

Sharepoint Videos

http://www.slideshare.net/infopathsharepoint/infopath-sharepoint-video-tutorials

Activate Info path service

Install and Active Info path Service:

http://www.sharepointassist.com/2010/06/15/wheres-infopath-forms-services-in-sharepoint-2010/


Configure browser-enabled user form templates:


http://technet.microsoft.com/en-us/library/cc262263.aspx#browser