Showing posts with label sharepoint. Show all posts
Showing posts with label sharepoint. Show all posts

Tuesday, June 11, 2013

SharePoint 2010 error: Retrieving the COM class factory for component with CLSID {XXXX-XXXXXXXX-XXXXXXXXXXXx} failed due to the following error: 800703FA

The solution of this error

SharePoint 2010 error: Retrieving the COM class factory for component with CLSID {XXXX-XXXXXXXX-XXXXXXXXXXXx} failed due to the following error: 800703FA


This error come when you create a console application with reference of Sharepoint dll, and when you default create a console application, it generate the exe in x86, but if your sharepoint is 64 bit it wont work, So change the build configuration for your console app for x64 bit.

Tuesday, October 13, 2009

How to insert lookupfield in Sharepoint List.

Here is the code to get the lookup column value and then insert into list.


private static SPFieldLookupValue GetIteminLookUpList(SPWeb webObject, string lookupListName, string lookupString)
{
SPFieldLookupValue fieldLookupValue = null;
try
{
if (CheckListExist(webObject.Lists, lookupListName) == false)
{
// Throw error if the list doesn't exists.
throw new ApplicationException(string.Format("{0}'s list doesn't exists!", lookupListName));
}
SPList lookupList = webObject.Lists[lookupListName];
foreach (SPListItem item in lookupList.Items)
{
if (item["Title"].ToString() == lookupString)
{
fieldLookupValue = new SPFieldLookupValue(item.ID, lookupString);
break;
}
}
return fieldLookupValue;
}
catch (Exception ex)
{
throw new ApplicationException("Error: " + ex.Message);
}
}