TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Gurinder Kaur
NA
4
6.2k
Add column to list programmatically.code (C#)
Jul 21 2017 5:53 AM
using (ClientContext ctx = new ClientContext(siteUrl))
{
if (siteUrl.ToLower().Contains(_SiteFormat)) ctx.Credentials = new SharePointOnlineCredentials
(userName, pwd);
else ctx.Credentials = new System.Net.NetworkCredential(userName, pwdS);
Web web = ctx.Web;
ListCollection listColl = web.Lists;
ListCreationInformation LCinfo = new ListCreationInformation();
LCinfo.Title = ListName;
LCinfo.TemplateType = (int)ListTemplateType.GenericList;
LCinfo.Description = "First Dynamic List";
listColl.Add(LCinfo);
ctx.Load(listColl);
ctx.ExecuteQuery();
List tList = listColl.GetByTitle(ListName);
FieldCollection fcol = tList.Fields;
FieldType colType = FieldType.Text;
//(error: Parameter overloaded for following line of code)
tList.Fields.Add("EmpId", colType, true);
tList.Update();
Console.WriteLine("Lists on the current site:\n\n");
}
}
Already tried 'newList.Fields.Add(
"My Column"
, FieldType.Text,
true
);'
PLEASE HELP...URGENTLY REQUIRED....Thank you!!
Reply
Answers (
2
)
PnP Lookup field get and Set
What types of authentication does Business Connectivity Serv