C# 如何查看SharePoint上讨论板的所有讨论和回复?

C# 如何查看SharePoint上讨论板的所有讨论和回复?,c#,sharepoint,sharepoint-designer,C#,Sharepoint,Sharepoint Designer,我在SharePoint 2007中有一个讨论板,我想在其中查看同一页面上的所有讨论及其答复。例如,我在讨论板中进行了3次讨论,并给出了一些回复。我希望在页面上显示类似以下输出的内容: (+) discussion no. 1 replies:3 (+) discussion no. 2 replies:1 (+) discussion no. 3 replies:0 (+)讨论第1号答复:3 (+)第2号讨论答复:1 (+)第3号讨论答复:0 然后单击展开(+),

我在SharePoint 2007中有一个讨论板,我想在其中查看同一页面上的所有讨论及其答复。例如,我在讨论板中进行了3次讨论,并给出了一些回复。我希望在页面上显示类似以下输出的内容:

(+) discussion no. 1 replies:3 (+) discussion no. 2 replies:1 (+) discussion no. 3 replies:0 (+)讨论第1号答复:3 (+)第2号讨论答复:1 (+)第3号讨论答复:0 然后单击展开(+),我想查看每个讨论的所有回复:

(-) discussion no. 1 replies:3 (+) this is the reply to discussion no. 1 (+) this is the 2nd reply to discussion no. 1 (+) discussion no. 2 replies:1 (+) discussion no. 3 replies:0 (-)讨论1答复:3 (+)这是对第一次讨论的答复 (+)这是对第一次讨论的第二次答复 (+)第2号讨论答复:1 (+)第3号讨论答复:0
有人知道怎么做吗?

我终于找到了解决办法。我不得不改变我做事的方式。特别是从十六进制转换接收到的值,必须在没有0x前缀的情况下进行

关键仍然是在应用了一些模糊的魔法后发送相同的ThreadingIndex值。以下是我使用SharePoint web services api为讨论添加回复的代码:

        String trimmedBody = itemNode.Attributes.GetNamedItem("ows_BodyAndMore").Value;
        String threadIndex = itemNode.Attributes.GetNamedItem("ows_ThreadIndex").Value;

        StringBuilder mesBody = new StringBuilder(1024);

        mesBody.AppendFormat("Message-ID: {0}\n", Guid.NewGuid().ToString());

        threadIndex = threadIndex.Substring(2);
        byte[] byteArray = FromHex(threadIndex);                        
        threadIndex = base64Encode(byteArray);
        string encoded = threadIndex;

        mesBody.AppendFormat("Thread-Index: {0}\n", encoded);
        mesBody.AppendFormat("Subject: {0}\n", title); //the ows_Title of the discussion - messages don't always have titles...
        mesBody.Append("Mime-Version: 1.0\n");
        mesBody.Append("Content-type: text/html; charset=UTF-8\n\n");
        mesBody.Append(body);
        mesBody.Append(trimmedBody);
        client.AddDiscussionBoardItem(ListName, Encoding.UTF8.GetBytes(mesBody.ToString()));

    public static byte[] FromHex(string hex)
    {
        hex = hex.Replace("-", "");
        byte[] raw = new byte[hex.Length / 2];
        for (int i = 0; i < raw.Length; i++)
        {
            raw[i] = Convert.ToByte(hex.Substring(i * 2, 2), 16);
        }
        return raw;
    }

    public string base64Encode(byte[] data)
    {
        try
        {
            byte[] encData_byte = data;
            string encodedData = Convert.ToBase64String(encData_byte);
            return encodedData;
        }
        catch (Exception e)
        {
            throw new Exception("Error in base64Encode" + e.Message);
        }
    }
String trimmedBody=itemNode.Attributes.GetNamedItem(“ows\u BodyAndMore”).Value;
String threadIndex=itemNode.Attributes.GetNamedItem(“ows_threadIndex”).Value;
StringBuilder mesBody=新的StringBuilder(1024);
AppendFormat(“消息ID:{0}\n”,Guid.NewGuid().ToString());
threadIndex=threadIndex.Substring(2);
字节[]byteArray=FromHex(线程索引);
threadIndex=base64编码(byteArray);
字符串编码=线程索引;
AppendFormat(“线程索引:{0}\n”,编码);
AppendFormat(“主题:{0}\n”,标题)//讨论的ows_标题-邮件并不总是有标题。。。
Append(“Mime版本:1.0\n”);
Append(“内容类型:text/html;charset=UTF-8\n\n”);
附体;
附属物(三体);
AddDiscussionBoardItem(ListName,Encoding.UTF8.GetBytes(mesBody.ToString());
公共静态字节[]FromHex(字符串十六进制)
{
十六进制=十六进制。替换(“-”,“”);
字节[]原始=新字节[hex.Length/2];
for(int i=0;i
希望这有帮助