Users Registered: 42
SharePoint2010: Architecture of Business Connectivity Services
Business Connectivity Services (BCS)
Business Connectivity Services (formerly known as the Business Data Catalog) provides access to external data sourced from a Line of Business system, web services or other external data provider within SharePoint 2010 and Office 2010 applications.
Both SharePoint 2010 and Office 2010 applications have product features that can use external data directly and tools are also provided in SharePoint Designer 2010 and Visual Studio 2010 for working with External Data. Business Connectivity Services is built on the Business Data Catalog that was included in Office SharePoint Server 2007 and adds write capability, new tools, offline caching from Office Client 2010 applications and more.
Enhancements in the infrastructure configuration allow you to specify which servers can manage this process, enhance the ability to locate the profile pages created for the entities, and create opportunities for easier connections to existing data sources.
External lists also provide a greater level of control for the developer because the table structure, indexing, and access methods can be customized to improve performance of the list or to match internal guidelines. This allows developers to include large lists and tables in existing systems in their solutions with the ability to tune the performance as they better understand how the users will use the tool.
Figure shows how the inclusion of BCS creates opportunities to leverage SharePoint features and APIs against your existing line of business data that is available via direct database access or via web services.
Insert item in sharepoint Lookup Field, Multiple Lookup Field, User Field
Lookup Field
Field Class: SPFieldLookup
Field Value Class: SPFieldLookupValue
Populating Information:
item["FieldName"] = new SPFieldLookupValue("Title"); // SharePoint will do the lookup as long as the LookupValue's are unique
item.Update();
or
item["FieldName"] = new SPFieldLookupValue(1, "Title");
item.Update();
Retrieving Information:
SPFieldLookupValue itemValue = item["FieldName"] as SPFieldLookupValue;
int id = itemValue.LookupId;
string value = itemValue.LookupValue;
Multiple Lookup Field
Field Class: SPFieldLookup
Field Value Class: SPFieldLookupValueCollection
Populating Information:
SPFieldLookupValueCollection itemValues = SPFieldLookupValueCollection();
itemValues.Add(new SPFieldLookupValue(1, "Title"));
item["FieldName"] = itemValues;
item.Update();
Retrieving Information:
SPFieldLookupValueCollection itemValues = item["FieldName"] as SPFieldLookupValueCollection;
foreach (SPFieldLookupValue itemValue in itemValues)
{
int id = itemValue.LookupId;
string value = itemValue.LookupValue;
}
User Field
Field Class: SPFieldUser
Field Value Class: SPFieldUserValue
Populating Information:
web.EnsureUser(@"domain\username");
SPUser user = web.AllUsers[@"domain\username"];
item["FieldName"] = user;
item.Update();
Retrieving Information:
string currentValue = item["FieldName"].ToString();
SPFieldUser userField = list.Fields.GetFieldByInternalName("FieldName");
SPFieldUserValue itemValue = (SPFieldUserValue)userField.GetFieldValue(currentValue);
SPUser user = itemValue.User;
URL Field
Field Class: SPFieldUrl
Field Value Class: SPFieldUrlValue
Populating Information:
SPFieldUrlValue urlValue = new SPFieldUrlValue();
urlValue.Url = "http://www.google.com";
urlValue.Description = "Google";
item["FieldName"] = urlValue;
item.Update();
Retrieving Information:
SPFieldUrlValue urlValue = new SPFieldUrlValue(item["FieldName"].ToString());
string url = urlValue.Url;
string description = urlValue.Description;
Multiple Choice Field
Field Class: SPFieldMultiChoice
Field Value Class: SPFieldMultiChoiceValue
Populating Information:
SPFieldMultiChoiceValue itemValue = new SPFieldMultiChoiceValue();
itemValue.Add("Choice 1");
itemValue.Add("Choice 2");
itemValue.Add("Choice 3");
item["FieldName"] = itemValue;
item.Update();
Retrieving Information:
SPFieldMultiChoiceValue itemValue = new SPFieldMultiChoiceValue(item["FieldName"].ToString());
foreach (string choice in itemValue)
{
// value is in choice
} |