Question

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

Was it helpful?

Solution

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

OTHER TIPS

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++;
                }
            }
        }
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top