0

Sorry for the weird question as I am really just learning SharePoint and do not know the best vernacular.

at work, we have code that accesses a sharepoint list item, then selects and expands the columns so that we can use the data in those columns.

MY CONFUSION: I often see when we are selecting columns, in the react code we add a slash(/) after some of the column names and then an additional identifier to access additional data on the column.(I think this is called a lookup column)

But how can I see a list of all the available "additional identifiers" for each column

on SharePoint, the columns only show the part before the slash, enter image description here

but it doesnt show whats possible to use after the slash. Such as this Title identifier

 'ItemModified',
 'ItemModifiedBy/Title', <- This is what I'm referring to as an additional identifier

How do I know /Title is a possibility? I mean yea, I can see it in this code that someone else wrote, but how did they know /Title was even a thing? I don't see any documentation. How do I know what other identifiers there are for me to use?

And I couldn't find anything in the documentation that lays out a list of additional identifiers for each column type (or maybe i just dont know the right terms to search), I was hoping to find something like this :

ItemModifiedBy additional identifiers:

  • Title

  • EMail

  • ...etc

ItemCreatedBy additional identifiers:

  • Id

  • Title

  • EMail

  • ...etc

Here is a small code snippet for work

  const listName = ListNames().StudentList
  const StudentArticlesData = []
  const list = sp.web.lists.getByTitle(listName)
  const endpoint = [
    'ID',
    'Title',
    'Question',
    'Description',
    'Answer',
    'Category',
    'Subcategory',
    'Tags',
    'IsArchived',
    'ItemCreated',
    'ItemCreatedBy/Title',
    'ItemModified',
    'ItemModifiedBy/Title',
    'AttachmentFiles',
  ]
  const expand = ['ItemCreatedBy', 'ItemModifiedBy', 'AttachmentFiles']

  const items = await list.items
    .select('' + endpoint + '')
    .expand('' + expand + '')
    .orderBy('ItemCreated', false)
    .get()

Also, they guy who created this stuff is gone, so its only me. So I can't ask questions.

1 Answers1

1

The type of the column you are referring to is people picker. Therefore, its value is actually an "object" that has properties of its own (you have similar ones like "URL" column type for example, "Taxonomy" type, etc)

I have not seen an official documentation or an official API to get a full list of available properties; it seems that everyone just keeps using some "known" sub-set:

Id, ContentTypeID, ContentType, Name, Modified, Created, Account, EMail, MobileNumber, AboutMe, SipAddress, IsSiteAdmin, Deleted, Hidden, Picture, Department, JobTitle, LastName, FirstName

https://social.technet.microsoft.com/wiki/contents/articles/31210.sharepoint-2013-get-user-details-from-person-or-group-field-using-rest-api.aspx

If you want to go deeper, behind the screens, there is a hidden list on the SharePoint site called "User Information List", that is how "people picker" field type actually works. The above set appears to be a subset of fields of that list. You can get the full list of fields of that list using:

<yoursite>/_api/web/lists/getbytitle('User Information List')/fields

If you do that, you'll find more properties that work. Maybe these are dependent on the SharePoint version you are using. Anyway, I have not seen official documentation regarding these, unfortunately.

For example, for me, the above query return all fields from short list aove, but also many other fields like AdjustHijriDays or MUILanguages, that actually work, i.e. ItemModifiedBy/AdjustHijriDays should give you something and that something is not an error message.

Below is the list I got on my site. Some of the properties are working, some don't (and I have excluded the fields starting with underscore, since these are obviously for internal usage):

AccessPolicy, AdjustHijriDays, AltCalendarType, AppAuthor, AppEditor, Attachments, Author, BaseName, CalendarType, CalendarViewOptions, ComplianceAssetId, ContentLanguages, ContentType, ContentTypeDisp, ContentTypeId, ContentVersion, Created, Created_x0020_Date, Deleted, Department, DocIcon, Edit, Editor, EditUser, EMail, EncodedAbsUrl, File_x0020_Type, FileDirRef, FileLeafRef, FileRef, FirstName, FolderChildCount, FSObjType, GroupEdit, GroupLink, GUID, HTML_x0020_File_x0020_Type, ID, ImnName, InstanceID, IsActive, IsSiteAdmin, ItemChildCount, JobTitle, Last_x0020_Modified, LastName, LinkFilename, LinkFilename2, LinkFilenameNoMenu, LinkTitle, LinkTitle2, LinkTitleNoMenu, Locale, MetaInfo, MobilePhone, Modified, MUILanguages, Name, NameWithPicture, NameWithPictureAndDetails, NoExecute, Notes, Office, Order, OriginatorId, OtherMail, owshiddenversion, ParentUniqueId, PermMask, Picture, PictureDisp, PictureOnly_Size_36px, PictureOnly_Size_48px, PictureOnly_Size_72px, PrincipalCount, ProgId, Restricted, ScopeId, SelectTitle, ServerUrl, SipAddress, SMLastModifiedDate, SMTotalFileCount, SMTotalFileStreamSize, SMTotalSize, SortBehavior, SPSPictureExchangeSyncState, SPSPicturePlaceholderState, SPSPictureTimestamp, SPSResponsibility, SyncClientId, Time24, TimeZone, Title, UniqueId, UserExpiration, UserInfoHidden, UserLastDeletionTime, UserName, UserSelection, WebSite, WorkDayEndHour, WorkDays, WorkDayStartHour, WorkflowInstanceID, WorkflowVersion, WorkPhone

I'm wondering if this list may be extended by a user or some app, solution, or a service like extended profile (most probably it may be) so the properties you can get may actually be specific to the organization you are working with. But here I am not certain, let others correct me here if I am wrong. The common base should be the first "short list" anyway.

Nikolay
  • 10,752
  • 2
  • 23
  • 51