0

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).

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.

  • Many of our sites have renamed the OOTB forms amd reused the default urls in order to make use of a code library. The OOTB forms have a property indicating which type of page it is, but I believe you lose that property on custom forms. – Dinerdo Feb 20 '18 at 12:42
  • Another comment - some of the custom forms exist to supplement the default forms, so this would also prevent me from finding those. – Dinerdo Feb 22 '18 at 18:32
1

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?

  • This was my last option, but I guess I was hoping to find a more direct property on the list or content types even if it was in the xml itself. – Dinerdo Feb 20 '18 at 12:46
  • @Dinerdo Not that I know of. – Mike Smith - MCT - MVP Feb 21 '18 at 0:17
0

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));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.