Add Calendar Webpart to page
string filename = “SitePages/mypage.aspx”;
SPList list = web.Lists["Calendar"];
SPLimitedWebPartManager wpMgr = web.GetLimitedWebPartManager(filename,
System.Web.UI.WebControls.WebParts.
PersonalizationScope.Shared);
SPLimitedWebPartManager webPartManager = web.GetLimitedWebPartManager(filename,
System.Web.UI.WebControls.WebParts.
PersonalizationScope.Shared);
ListViewWebPart listViewWebPart = new
ListViewWebPart();
listViewWebPart.ListName = list.ID.ToString(“B”).ToUpper();
listViewWebPart.TitleUrl = list.DefaultViewUrl;
listViewWebPart.ViewType = ViewType.Calendar;
listViewWebPart.Title = “Kalender”;
listViewWebPart.ViewGuid = string.Empty;
webPartManager.AddWebPart(listViewWebPart, CommonConst.MiddleLeftZone, 0);

TFS Build server Error permissions
“Failed to create directory ‘\\myshare\inetpub\wwwroot\mywebsite\mywebsite\mywebsite_20100610.3′. User ‘NT AUTHORITY\NETWORK SERVICE’ needs write permissions to the path.”
To change the account, you’ll need to:
- Log in to the server hosting the Team Foundation Build service
- Start the Team Foundation Server Administration Console
- Select the ‘Build Configuration’ node in the left hand tree
- Find your build service at the top of the panel and select ‘Properties’ to configure it
- You’ll need to ‘Stop to make changes’ via the link in the popup window
- Finally in the ‘credentials’ section at the bottom change the radio button and put in the name and password for the account you wish to use.
I now have builds being pushed up successfully to our development server.
To change the account, you’ll need to:
- Log in to the server hosting the Team Foundation Build service
- Start the Team Foundation Server Administration Console
- Select the ‘Build Configuration’ node in the left hand tree
- Find your build service at the top of the panel and select ‘Properties’ to configure it
- You’ll need to ‘Stop to make changes’ via the link in the popup window
- Finally in the ‘credentials’ section at the bottom change the radio button and put in the name and password for the account you wish to use.
User Profile Synchronization
Event Log:
The server encountered an unexpected error and stopped.
”ERR: MMS(1516): sql.cpp(5580): Query (CSession::Open()) performed with error
ERR: MMS(1516): sql.cpp(5601): Error retrieving error
BAIL: MMS(1516): sql.cpp(568): 0×80230406 (An error has occurred at the store)
BAIL: MMS(1516): sql.cpp(384): 0×80230406 (An error has occurred at the store)
BAIL: MMS(1516): sql.cpp(256): 0×80230406 (An error has occurred at the store)
BAIL: MMS(1516): storeimp.cpp(272): 0×80230406 (An error has occurred at the store)
ERR: MMS(1516): server.cpp(294): Failed to connect to the database User Profile Service Application_SyncDB_25480d71476c456e861f8d660a1eb297 on TSTMSDB02
BAIL: MMS(1516): server.cpp(295): 0×80230406 (An error has occurred at the store)
BAIL: MMS(1516): server.cpp(3518): 0×80230406 (An error has occurred at the store)
BAIL: MMS(1516): service.cpp(1528): 0×80230406 (An error has occurred at the store)
ERR: MMS(1516): service.cpp(977): Error creating com objects. Error code: -2145188858. This is retry number 0.
ERR: MMS(1516): sql.cpp(5580): Query (CSession::Open()) performed with error
ERR: MMS(1516): sql.cpp(5601): Error retrieving error
BAIL: MMS(1516): sql.cpp(568): 0×80230406 (An error has occurred at the store)
BAIL: MMS(1516): sql.cpp(384): 0×80230406 (An error has occurred at the store)
BAIL: MMS(1516): sql.cpp(256): 0×80230406 (An error has occurred at the store)
BAIL: MMS(1516): storeimp.cpp(272): 0×80230406 (An error has occurred at the store)
ERR: MMS(1516): server.cpp(294): Failed to connect to the database User Profile Service Application_SyncDB_25480d71476c456e861f8d660a1eb297 on TSTMSDB02
BAIL: MMS(1516): server.cpp(295): 0×80230406 (An error has occurred at the store)
BAIL: MMS(1516): server.cpp(3518): 0×80230406 (An error has occurred at the store)
BAIL: MMS(1516): service.cpp(1528): 0×80230406 (An error has occurred at the store)
ERR: MMS(1516): service.cpp(977): Error creating com objects. Error code: -2145188858. This is retry number 1.
ERR: MMS(1516): sql.cpp(5580): Query (CSession::Open()) performed with error
ERR: MMS(1516): sql.cpp(5601): Error retrieving error
BAIL: MMS(1516): sql.cpp(568): 0×80230406 (An error has occurred at the store)
BAIL: MMS(1516): sql.cpp(384): 0×80230406 (An error has occurred at the store)
BAIL: MMS(1516): sql.cpp(256): 0×80230406 (An error has occurred at the store)
BAIL: MMS(1516): storeimp.cpp(272): 0×80230406 (An error has occurred at the store)
ERR: MMS(1516): server.cpp(294): Failed to connect to the database User Profile Service Application_SyncDB_25480d71476c456e861f8d660a1eb297 on TSTMSDB02
BAIL: MMS(1516): server.cpp(295): 0×80230406 (An error has occurred at the store)
BAIL: MMS(1516): server.cpp(3518): 0×80230406 (An error has occurred at the store)
BAIL: MMS(1516): service.cpp(1528): 0×80230406 (An error has occurred at the store)
ERR: MMS(1516): service.cpp(977): Error creating com objects. Error code: -2145188858. This is retry number 2.
ERR: MMS(1516): sql.cpp(5580): Query (CSession::Open()) performed with error
ERR: MMS(1516): sql.cpp(5601): Error retrieving error
BAIL: MMS(1516): sql.cpp(568): 0×80230406 (An error has occurred at the store)
BAIL: MMS(1516): sql.cpp(384): 0×80230406 (An error has occurred at the store)
BAIL: MMS(1516): sql.cpp(256): 0×80230406 (An error has occurred at the store)
BAIL: MMS(1516): storeimp.cpp(272): 0×80230406 (An error has occurred at the store)
ERR: MMS(1516): server.cpp(294): Failed to connect to the database User Profile Service Application_SyncDB_25480d71476c456e861f8d660a1eb297 on TSTMSDB02
BAIL: MMS(1516): server.cpp(295): 0×80230406 (An error has occurred at the store)
BAIL: MMS(1516): server.cpp(3518): 0×80230406 (An error has occurred at the store)
BAIL: MMS(1516): service.cpp(1528): 0×80230406 (An error has occurred at the store)
ERR: MMS(1516): service.cpp(977): Error creating com objects. Error code: -2145188858. This is retry number 3.
BAIL: MMS(1516): service.cpp(991): 0×80230406 (An error has occurred at the store)
Forefront Identity Manager 4.0.2450.11″
Solution:
Cumulative Update from 31. August 2010.
- Install SharePoint Foundation 2010 hotfix KB 2352346 and restart server
- Install SharePoint Server 2010 hotfix KB 2352342 and restart server
- Delete and Config the User Profile Service again.
SharePoint 2010 Cumulative Update for August 31 2010
- SharePoint Foundation 2010 KB 2352346
- SharePoint Server 2010 KB 2352342
- SharePoint Server 2010 and Project Server 2010 KB 2352345
SharePoint Add\Get values from fields
When programming against SharePoint lists, it is difficult to retrieve or add value to a lookup field, hyperlink, Drop Down (choice) field. So I decided to share the experience with you
Add Value to Hyperlink (SPFieldUrlValue)
SPList oList = oWeb.Lists["YourListName"];
SPListItem newLink = oList.Items.Add();
SPFieldUrlValue oUrlValue = new
SPFieldUrlValue();
oUrlValue.Description = “Your link title”;
oUrlValue.Url = “http://www.YourLink.com/ “;
newLink["URL"] = oUrlValue;
newLink.Update();
Get Hyperlink values (SPFieldUrlValue)
SPList oList = oWeb.Lists["YourListName"];
SPListItem oListItem = oList.Items[0];
SPFieldUrlValue oUrlValue = new
SPFieldUrlValue(oListItem ["YourLinkItemFieldName"].ToString());
string linkTitle = oUrlValue.Description;
string linkURL = oUrlValue.Url;
Add value to LookupField (SPFieldLookupValue)
SPList oList = oWeb.Lists["YourListName"];
SPListItem oListItem = oList.Items.Add();
oListItem ["Title"] = “YorNewTitle”;
SPFieldLookupValue newValue = new
SPFieldLookupValue(14,“YourNewValue”);
oListItem ["LookupFieldName"] = newValue;
oListItem.Update();
Get Lookup value
SPList oList = oWeb.Lists["YourListName"];
SPListItem oListItem = list.Items[0];
SPFieldLookupValue LookupGroup = new
SPFieldLookupValue(oListItem["LookupFieldName"].ToString());
int lookedUpItemID = LookupGroup.LookupId;
string lookedUpItemTitle = LookupGroup.LookupValue;
Get People and group field value
SPList oList = oWeb.Lists["YourListName"];
SPListItem oListItem = list.Items[0];
SPFieldUser userField = (SPFieldUser) oListItem.Fields.GetField(“AssignedTo”);
SPFieldUserValue fieldValue = (SPFieldUserValue) userField.GetFieldValue(oListItem ["AssignedTo "].ToString());
SPUser _user = fieldValue.User;
string _logingName = _ user.LoginName.ToString();
SharePoint 2010 – SiteColumn and ContentType in VS2010
- Create a SharePoint Empty project in Visual Studio 2010
- Righ click on project folder in VS 2010 and Add -> New Item…
- Sellect Content Type

Click Add. - Type in the ContentTypes\Elements.xml
|
Elements.xml <?xml Site Columns <!– Site Columns: –> <!– Site Lookup Columns: –> <!– Site Lookup Columns: –> ContentType <!– Parent ContentType: SiteInfo based on Item (0×01) –> <ContentType
|
Now you have created Site Columns and Site ContentType.
The ContentType and SiteColumns are ready to deployment to SharePoint Farms.
SharePoint 2010 – Hands on Lab
Microsoft has posted some good basic explanation and samples for SharePoint development.
SharePoint 2010 Search Service Application – Configuration
How to configure the Search service in SharePoint 2010?
1. Go to Central Administration
2. Select Manage Services Applications under the Application Management Menu.

3. Here is a list of all service applications. Click New and select Search Service Application.

4. Please enter the name of the Application Service and account information.

5. Click OK to complete configuration.
6 Here is an overview of Index and crawl and database contents.

SharePoint 2010/2007 Custom Site Column – Field Type and Options
|
Type (as shown on the Create Column page) |
Field Type |
Notes |
MSDN Links |
|
Single line of text |
Type=”Text” |
|
|
|
Multiple lines of text |
Type=”Note” |
In the Create Column page, can pick the type of text to allow. To enable the different sub-types, you need to set a couple of other attributes on the field element. Plain Text Rich Text Enhanced Text In addition, you can also set the number of lines to display using the NumLine attribute. Further Information on MSDN: |
|
|
Choice (menu to choose from) |
Single Choice Multi-Choice |
Pick the display format for the Choice and Multi-Choice types, respectively: Drop-Down Menu or Combo Box Radio Buttons or Check Boxes Define the options a user can pick from using the Choices element. Below is a skeleton to explain this. <Field Name=”MyOptions” Type=……> If you would like to give the user an option to add their own value, set the attribute FillInChoice=”TRUE”. |
Microsoft.Sharepoint.SPFieldChoice |
|
Number |
Type=”Integer” |
This field type also lets you define: Minimum Value (0 for example) Maximum Value (100 for example) Decimal Places (Default is Automatic, example 2 decimal places) Show as Percentage (Default is False) |
|
|
Currency |
Type=”Currency” |
This field type also lets you define: Minimum Value (0 for example) Maximum Value (100 for example) Decimal Places (Default is Automatic, example 2 decimal places) Currency Format LCID=”3081″ 3081 sets the format English – Australian. For a complete list of Locales, see the MSDN link in the next column. |
|
|
Date and Time |
Type=”DateTime” |
This field also lets you define: Date and Time Format Show the date and time: |
|
|
Yes/No |
Type=”Boolean” |
When setting the default value, you need to use the binary values: No/False = 0 |
|
|
Person or Group |
Single User or Group Multiple Users or Groups |
This field also lets you define: Allow multiple selections Allow selection of People and Groups Choose from Show field If you would also like to show presence (Office Communicator integration required): |
|
|
Hyperlink or Picture |
Type=”URL” |
You can display the URL as a Hyperlink or Picture. Use the Format attribute to pick which one: Hyperlink Picture |

