Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm working on a project to automatically generate some document libraries and pages. One of these pages I have to put a infopath form webpart and a TextFilter to send to this form some information (a string to indicate to report to autorun query). Where you have the code:

  SPLimitedWebPartManager manager = file.GetLimitedWebPartManager(PersonalizationScope.Shared);
        try
        {
            XmlFormView form = new XmlFormView();
            String templateLib = "FormServerTemplates";
            String xsnName = report + ".xsn";
            form.XsnLocation = String.Format("{0}/{1}/{2}", "~sitecollection", templateLib, xsnName);      
            manager.AddWebPart(form, "TopZone", 0);

            QueryStringFilterWebPart filter = new QueryStringFilterWebPart();
            filter.DefaultValue = "TRUE";
            filter.QueryStringParameterName = "ENTITY";
            filter.FilterName = "execquery";
            filter.AllowConnect = true;
            manager.AddWebPart(filter, "TopZone", 1);

            System.Web.UI.WebControls.WebParts.WebPart addSearch = manager.WebParts[0];
            System.Web.UI.WebControls.WebParts.WebPart addDisplay = manager.WebParts[1];

            ConsumerConnectionPoint consumerConnection = null;
            foreach (ConsumerConnectionPoint point in manager.GetConsumerConnectionPoints(addSearch))
            {
                if (point.InterfaceType == typeof(IFilterValues))
                {
                    consumerConnection = point; break;
                }
            }

            ProviderConnectionPoint providerConnection = null;
            foreach (ProviderConnectionPoint point in manager.GetProviderConnectionPoints(addDisplay))
            {
                if (point.InterfaceType == typeof(Microsoft.SharePoint.WebPartPages.ITransformableFilterValues))
                {
                    providerConnection = point; break;
                }
            }

            manager.SPConnectWebParts(addSearch, providerConnection, addDisplay, consumerConnection);
        }

When I try to do the connection, consumerConnection is empty, So I understand that xmlformview doesn't have any connection to do this "connection". Are there some way to do this page programatically?

Thanks!

share|improve this question

1 Answer

How are the querystring values used within the InfoPath forms themselves? You can always use codebehind in the forms to get the querystring values directly, as long as the code isn't Usercode (Sandbox code):

http://stackoverflow.com/questions/7430676/how-to-get-querystring-value-in-infopath-forms

share|improve this answer
I check this option but how can I assign an url param in xmlformview object?? – Xavi Guirao Nov 13 '12 at 15:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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