Is there any property available in CSOM which would indicate that a list is using a custom new/edit/display form?

sharepoint.stackexchange https://sharepoint.stackexchange.com/questions/236299

문제

I'm wondering if there's a simple way to check to see if a list is using a non-default custom form via CSOM? I'm thinking of looking for any forms that weren't created at the time of the list's creation or created by the default user if there's nothing more direct, but I'm hoping to avoid loading every file in every list (non-library).

도움이 되었습니까?

해결책 3

For now, I'm just going to see if the list has more than 3 forms in the list.Forms property as I'm hoping no one made the mistake of deleting an OOTB list form. If this doesn't hold up, you can use the form collection to filter out the files in the list and download each file. On each file, there is a CustomizedPageStatus property which can be checked. The value is None or 0 for every custom form I've seen thus far, and it is Uncustomized or 1 for every OOTB list form I've seen thus far. It's surprisingly, to me, very quick. It also includes custom view pages (e.g., views which have additional web parts added).

My code sample:

    context.Load(list.RootFolder.Files, f => f.Where(f => (int)f.CustomizedPageStatus != 1));

다른 팁

You can get the URL of displayform dynamically by making use of "ParentList" property.

   currentItem.ParentList.get_defaultDisplayFormUrl()
   currentItem.ParentList.get_defaultEditFormUrl()

Once you have it, you can validate if its OOB page or custom one.

From CSOM? Probably. :-) There is from REST. This will get you form files properties:

http://yourServer/sites/yourSite/_api/web/lists/getbytitle('TestList')/RootFolder/Files

and then: d.results[0].TimeLastModified

There is an example to get you to the RootFolder using CSOM here:

How do I get List from RootFolder in CSOM?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top