I have a SharePoint list with Roles as the columns(Admin, Viewer, Manager) and Document Types as the items (Word docs, PPtx docs, excel docs). I have filled in the corresponding values with the permissions each Role has per Doc Type.
I have built a web part with 2 dropdowns. Dropdown1 has Roles and Dropdown2 has Doc Types.
How can I use the selected value for each dropdown and query the corresponding value from the list?
Do I use CAML or can I use SharePoint object model?
using (SPSite siteCol = new SPSite("http://mySharepoint/"))
{
using (SPWeb web = siteCol.RootWeb)
{
SPList list = web.GetList("/Lists/PermissionMatrix");
SPListItem item = list.GetItemByIdSelectedFields([*Requires ID*], "Role");
String role1= (String)item["Roles"];
}
}
Doesn't work because I have to use the Item ID and I could only query the item using CAML
Please help. Thanks