Hot answers tagged

3

This code should work: (web is a variable that references the web object) SPFieldUserValue value = new SPFieldUserValue(web, item["AssignedTo"].ToString()); if (value) { assignToUser = value.User; }


2

You can try below code to get SPUser in AssignedTo columns for specific item. If(task["Assigned To"] != null) { string fieldValue = Convert.ToString(task["Assigned To"]); SPFieldUserValue assignedTo = (SPFieldUserValue) task.Fields["Assigned To"].GetFieldValue(fieldValue); }


2

Try this SPFieldUserValue userField = item.Fields["AssignedTo"] as SPFieldUser; string userName = item["AssignedTo"].ToString(); SPFieldUserValue fieldValue = (SPFieldUserValue)userField.GetFieldValue(userName); SPUser user = fieldValue.User; Taken from http://ethan-deng.blogspot.com/2013/03/get-spuser-from-user-column-there-are.html


2

You can try below code, using (SPSite siteCol = new SPSite("http://server/sites/Contoso")) { using (SPWeb web = siteCol.RootWeb) { SPList list = web.GetList("/sites/Contoso/Lists/Books"); SPListItem item = list.GetItemByIdSelectedFields(3, "Title", "ISBN", "Retail_x0020_Price"); String bookISBN = ...


2

Single line of text can store 255 characters. So you will be good even in case of IPv6. One drawback of storing interger in text field is that you will lose the out of the box ability to apply mathematical functions like SUM etc.


2

Use the below code, it will give you the list of Fields that are in Display in the View and the postiion from left. public static void GetViewDetails() { ClientContext context = new ClientContext("https://testsite/test"); List list = context.Web.Lists.GetByTitle("ListName"); context.Load(list); context....


2

Another Way You can get it using REST API. Just send a GET request to the following end point /_api/Web/Lists/GetByTitle('{list name}')/Views/GetByTitle('{view name }')/ViewFields In the response, you should get response like following { "d": { "__metadata": { "id": "Web/Lists/GetByTitle('Customers')/Views/GetByTitle('All Items')/...


2

You can check the ids from data.$1L_0 with the actual ids from your list. If they are same, then you can rely on data.$1L_0. Anyway following JSOM approach, you can flow: Add items in a array, then get ids from it using get_id(). var itemArray = []; var clientContext = SP.ClientContext.get_current(); var oList = clientContext.get_web().get_lists()....


1

You can use: query.QueryThrottleMode = SPQueryThrottleOption.Override; by executing the query as a super user. SharePoint 2010 List Throtelling Try the following code to get the items based on the folder, using(SPSite site = new SPSite("site url")) { using(SPWeb web = site.OpenWeb()) { SPFolder folder = web.GetFolder("/Docs/folder1"); if(...


1

Opening SP Designer 2013, I went to the lists and libraries, selected my list and edited the "AllItems.aspx" File. In this file, I put in my HTML that I wanted to show up in the list template. From here, I saved the .aspx file and went to my site. Then, I went to the list, hit the site actions button and clicked on "Edit this Page". I edited the List ...



Only top voted, non community-wiki answers of a minimum length are eligible