开发者

In Sharepoint, how do I update a task directly from a link in an email?

开发者 https://www.devze.com 2023-01-09 21:42 出处:网络
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

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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消