Project Server PSI的简单调用方式:读取和下载工作分配备注

我们继续前面的介绍,前面提到可以很容易的读取到任务审批历史纪录,那么任务提交注释同样可以很方便的拿到,并且下载下来:

前提是选择了"发送注释"框,默认都是选中的,赶紧看看代码实现吧:

if (Request["taskid"].Length > 0)

{

Guid taskid = new Guid(Request["taskid"]);

 

byte[] rtfbytes = PJContext.Current.PSI.StatusingWebService.ReadPublishedNoteForTask(taskid);

if (rtfbytes != null)

{

string rtftext = new String(new ASCIIEncoding().GetChars(rtfbytes));

Response.Write(rtftext);

}

}

如上,代码段需要任务ID号,直接拿到了byte[]数组,我们提前在页面上加入:

<%@ Page Language="C#" Inherits="###你的项目Namespace" Debug="true" ContentType="application/msword" %>

即可实现Word下载!

posted @ 2011-06-18 23:43  pccai  阅读(500)  评论(1编辑  收藏  举报