1

How to retrieve all list/library which uses InfoPath forms in a site collection?

It would be helpful if you post your answers in C# code or SQL query.

Thanks

0

2 Answers 2

0

After doing lot of research, I've found out a way via powershell

$list = $web.Lists["documentLibraryName"]

$isUsingInfoPath = $list.ContentTypes[0].ResourceFolder.Properties["_ipfs_infopathenabled"]

It returns true if infopath is enabled on the list. Could someone help me on c# code equivalent ? Thanks

0

You can iterate through all available items in all lists. If 'ProgID' of any item contains 'InfoPath' then that list is using InfoPath Form.

This is not afull proof solution but it can help.

See image below:

ProgID property for Item

    SPSite site = new SPSite("http://xyz:123/sites/sample_1");
        SPWeb web = site.OpenWeb();
        int libCount = 0;

        foreach (SPList list in web.Lists)
        {
            foreach (SPListItem item in list.Items)
            {
                string progId = item["ProgId"].ToString();

                if (!string.IsNullOrEmpty(progId) && progId.IndexOf("InfoPath", StringComparison.OrdinalIgnoreCase) != -1)
                {
                    libCount++;
                }
            }
        }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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