Programmatically Set a QueryStringFilterWebPart / ExcelWebRenderer Connection

Posted by user355972 on Stack Overflow See other posts from Stack Overflow or by user355972
Published on 2010-06-02T01:00:58Z Indexed on 2010/06/02 1:03 UTC
Read the original article Hit count: 1116

Filed under:
|

Code:

        public static void ChartPageConnector(SPWeb web, string pageURL, string providerWpId, string consumerWpId, string mappedName)
    {
        SPFile file = web.Files[pageURL];
        SPLimitedWebPartManager mgr = file.GetLimitedWebPartManager(PersonalizationScope.Shared);

        TransformableFilterValuesToFilterValuesTransformer transformer = new TransformableFilterValuesToFilterValuesTransformer();
        transformer.MappedConsumerParameterName = mappedName;

        //QueryStringFilterWebPart provider = (QueryStringFilterWebPart)mgr.WebParts[providerWpId];
        //ExcelWebRenderer consumer = (ExcelWebRenderer)mgr.WebParts[consumerWpId];
        JWP.WebPart provider = mgr.WebParts[providerWpId];
        JWP.WebPart consumer = mgr.WebParts[consumerWpId];


        ProviderConnectionPoint pcp = null;
        foreach (ProviderConnectionPoint ppoint in mgr.GetProviderConnectionPoints(provider))
        {
            if (ppoint.InterfaceType ==
            typeof(Microsoft.SharePoint.WebPartPages.ITransformableFilterValues))
            {
                pcp = ppoint;
                break;
            }
        }

        ConsumerConnectionPoint ccp = null;
        foreach (ConsumerConnectionPoint cpoint in mgr.GetConsumerConnectionPoints(consumer))
        {
            if (cpoint.InterfaceType == typeof(IFilterValues))
            {
                ccp = cpoint;
                break;
            }
        }

        //mgr.SPConnectWebParts(provider, pcp, consumer, ccp);
        mgr.SPConnectWebParts(provider, pcp, consumer, ccp, transformer);

        file.Update();
        web.Update();
    }

Error:

The connection point "IFilterValues" on "g_33d68e82_6478_4629_a079_5a7e02ac4695" is disabled.

Any Ideas Why?

© Stack Overflow or respective owner

Related posts about sharepoint

Related posts about webpart