Programmatically set Lookup Field Value in a SharePoint List using CSOM
List
data = GetLookupIDFromList(clientContext, "Account", "AccountID", "Some Value");
ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
ListItem newItem = oList.AddItem(itemCreateInfo);
newItem["Title"] = row.Field
newItem["OpportunityName"] = row.Field
if (data != null)
{
FieldLookupValue fld = new FieldLookupValue() { LookupId = int.Parse(data[0].Key) };
if (int.Parse(data[0].Key) > 0)
{
newItem["AccountID"] = fld.LookupId;
newItem["AccountName"] = fld.LookupId;
}
}
public static List
{
try
{
List
List list = context.Web.Lists.GetByTitle(listname);
//string strCAMLQuery = "
string strCAMLQuery = "
"
"
"
"
"
"
"
//If you are developing console application, use
// System.Web.HttpUtility.HtmlEncode(strLookupValue) instead of
//System.Web.HttpContext.Current.Server.HtmlEncode(strLookupValue)
CamlQuery query = new CamlQuery();
query.ViewXml = @"
ListItemCollection items = list.GetItems(query);
context.Load(items);
context.ExecuteQuery();
if (items.Count > 0)
{
// int iRet = items[0].Id;
data.Add(new KeyValuePair
return data;
}
else
{
return null;
}
}
catch (Exception ex)
{
return null;
}
}
Historical sights are aplenty. At Jalan Tun. H.S. Lee (formerly known as High Street), the Kwang Siew Association harks back to 1888. Its temple roofs and eaves are adorned with stone dragons and mythical creatures, while two stone lions watch over its entrance. Proceeding south will bring you to the Sri Maha Mariamman Temple and the High Street Police Station, which was built in Watch New Jobs Alerts On Jawatankosong.
ReplyDeleteMoves to reduce corporate and financial risks in China have also hit sentiment. Sweeping new rules for the asset management industry, a crackdown on micro loans and losses imposed on the creditors of the state-owned Chongqing Iron & Steel have jolted markets, pushing government bond yields to three year highs and causing a sharp drop in stock Watch New Jobs Alerts On Jawatankosong.
ReplyDeletePune is one of the foremost industrial cities in India and has been contributing gradually to several small, medium sized industries and offering jobs to more than thousands of people every year. Pune has India's growing IT, manufacturing, engineering and automobile Watch Latest Jobs Alerts On Jawatankosong.
ReplyDeleteNajib has denied wrongdoing and has consolidated power by sacking critics within his ruling party and cracking down on Watch Jobs in Malaysia 2018 On Jawatankosong.
ReplyDelete