在 Sharepoint 中,如何直接从电子邮件中的链接更新任务?

发布于 2024-09-11 13:16:48 字数 270 浏览 4 评论 0原文

我刚刚开始使用 sharepoint 设计器,并意识到可以做很多事情来扩展 sharepoint 中的基本功能。当(用户)创建新任务时,我们会发送一封电子邮件警报,我想自定义该电子邮件,以便它还包含一个名为“分配”的链接。单击时,我希望此链接自动使用单击它的人的分配给字段来更新任务。

因此,我认为执行此操作的方法是硬编码分配给此链接后面的 url 中的值,但我不知道这是否可能,或者是否有更简单/更好的方法来执行此操作。

任何建议将不胜感激,因为我是一个完全的初学者。

谢谢。

I'm just starting to use sharepoint designer and realised there's a lot that can be done to extend the basic features in sharepoint. We have an email alert sent out when a new task is created (by the user) and I want to customise the email so that it also includes a link called 'Assign'. When clicked, I want this link to automatically update the task with the assigned to field for the person that clicked it.

So I think the way to do this would be to hard-code the assign to value in the url behind this link, but I have no idea if this is possible or if there is an easier/better way to do this.

Any advice would be appreciated as I'm a complete beginner.

thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

围归者 2024-09-18 13:16:48

我不会在这里讨论“如何修改电子邮件警报的内容”,因为这是一个单独的问题,并且已经有很多文章介绍了这一点。

对于分配的链接:-

您需要创建一个自定义页面(或现有页面上的 Web 部件)作为分配链接的目标 - 这会将任务 ID 作为查询字符串参数,然后使用当前用户。

您可以通过获取 ListID 来使其灵活,但您可能需要考虑如何滥用它并采取适当的措施。

编辑-回应评论。

这是我的想法,没有在编译器中检查。这必须与 SharePoint 位于同一服务器上才能像使用 OM 一样工作 - 如果您想使用不同的服务器(为什么要这样做),请查看 Web 服务。

private void updateAssignedTo(Guid listId, int itemID)
{
   SPWeb web = SPContent.Current.Web();
   SPList list = web.Lists[listId];
   SPListItem item = list.GetItemById(itemID);
   item["Assigned To"] = web.CurrentUser;
   item.Update();
}

您将必须弄清楚如何将此代码放入页面或 Web 部件(我认为 SharePoint Designer 不会削减它,您需要 Visual Studio),但它是一个起点。

I will not cover "How to modify the contents of an eamil alert" here as that is a seperate question and there are a lot of articles that cover that already.

For the Assigned link :-

You would need to create a custom page (or web part on an existing page) as the destination of your Assign link - this would take the Task ID as a query string param and then update the assigned to with the current user.

You could make this flexible by also taking the ListID but you may want to think about how this could be abused and put appropriate measures in place.

EDIT - in response to comment.

This is top of my head, not checked in compiler. This would have to sit on the same server as SharePoint to work as its using the OM - if you want to use a different server (why would you though) then look in the web services.

private void updateAssignedTo(Guid listId, int itemID)
{
   SPWeb web = SPContent.Current.Web();
   SPList list = web.Lists[listId];
   SPListItem item = list.GetItemById(itemID);
   item["Assigned To"] = web.CurrentUser;
   item.Update();
}

You're going to have to work out how to get this code into to page or web part (SharePoint Designer is not going to cut it I think, you need Visual Studio) but its a starting point.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文