在我们公司,我们创建了一个自定义Issues
应用程序。除了在 Web 界面中使用这个应用程序之外,我们还希望能够通过 git commit hooks 自动更改问题的状态(新的、已确认的、测试的、已解决的……)。基础工作正常(即更改状态、添加注释等),但我们还希望将当前项目的责任更改为特定用户。在这种特殊情况下,如果这个项目是创建者。
我的第一次尝试如下:
var appid = 1234; var itemid = 1;
var item = podio.ItemService.GetItemByAppItemId(appid, itemid);
var update = new Item {ItemId = item.ItemId};
var creator = item.CreatedBy.Id;
var resp = update.Field<ContactItemField>("responsibility");
resp.ContactIds = new List<int>{creator.Value};
//change some other fields as well
podio.ItemService.UpdateItem(update);
这会引发“找不到对象”异常,因为resp.ContactIds
其中一个不能设置UserId
但ProfileId
.
然后我试图ProfileId
通过
podio.ContactService.GetUserContactField(creator.Value, "profile_id");
但这也会引发异常“(此方法不允许作为应用程序进行身份验证”)。
那么,当我将身份验证用作应用程序时,如何为用户获取适当的配置文件 ID?