Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Get the Names of all Fields in a SharePoint List
WhatsApp
Abhay Shanker
11y
43
k
0
0
25
Blog
Below Code block explains how to Get the Names of all fields in a SharePoint list Programmatically.
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
Microsoft.SharePoint;
namespace
SharePoint
{
class
ListFields
{
static
void
Main()
{
SPSecurity.RunWithElevatedPrivileges(
delegate
()
{
string
siteUrl =
"http://abhay-pc:1212"
;
SPSite site =
new
SPSite(siteUrl);
Console.WriteLine(site.ToString() +
"\n"
);
SPWeb web = site.OpenWeb();
SPList list = web.Lists[
"EmployeeDetails"
];
Console.WriteLine(list.ToString() +
"\n"
);
foreach
(SPField f
in
list.Fields)
{
Console.WriteLine(f.StaticName.ToString() +
" - "
+ f.TypeDisplayName.ToString() +
"\n"
);
}
});
Console.ReadLine();
}
}
}
Get the Names of all fields in a SharePoint list
Up Next
Set Current Logged User Name In SharePoint 2013 People Picker Field Using JavaScript/jQuery And REST
Ebook Download
View all
Getting Started with SharePoint Framework Development using TypeScript, PnP JS, and React JS
Read by 4.9k people
Download Now!
Learn
View all
Membership not found