使用SharePoint用户填充InfoPath控件

时间:2009-08-05 15:49:17

标签: c# xml web-services sharepoint infopath

我正在尝试使用UserGroup.asmx Sharepoint Web服务来填充InfoPath 2007(2003兼容表单)中的下拉列表。我按照这里的说明进行操作:http://tim.bellette.net/2008/12/13/getting-sharepoint-users-in-infopath-2003。我将以下代码放在表单的OnLoad事件中,如果我设置了断点,我可以看到GetUserCollectionFromGroupXML DOM包含正确的数据,但下拉列表仍为空。我不能来这里的是什么?

        XmlDocument userCollectionFromGroup = new XmlDocument();
        userCollectionFromGroup.LoadXml(thisXDocument.DataObjects["GetUserCollectionFromGroup"].DOM.xml);
        XPathNavigator siteUsers = userCollectionFromGroup.CreateNavigator();

        XmlNamespaceManager manager = new XmlNamespaceManager(siteUsers.NameTable);
        manager.AddNamespace("dfs", "http://schemas.microsoft.com/office/infopath/2003/dataFormSolution");
        manager.AddNamespace("tns", "http://schemas.microsoft.com/sharepoint/soap/directory/");

        // Query the user nodes
        XPathNavigator allUsers = siteUsers.SelectSingleNode("/dfs:myFields/dfs:dataFields/tns:GetUserCollectionFromGroupResponse/tns:GetUserCollectionFromGroupResult/tns:GetUserCollectionFromGroup/tns:Users", manager);

        // Load the users into the SiteUsersAndGroups connection
        thisXDocument.DataObjects["GetUserCollectionFromGroupXML"].DOM.loadXML("<GetUserCollectionFromGroup>" + allUsers.OuterXml + "</GetUserCollectionFromGroup>");

1 个答案:

答案 0 :(得分:0)

您是否尝试过对此代码进行重复数据删除?

这可能是权限问题。我有类似的东西。