Sharepoint: Create a link to either add an item to a list, or start a workflow
I'm creating a solution that involves a document with a link at the bottom (a way to get staff to read the document, then click the "I have read this" button.
We want to keep track of who has read the 开发者_JAVA百科document in a list, so I'd like for the user to click the button, and automatically add an entry to a list (which would just grab the username and date automatically). This can also be done through a workflow, if it's easier to start a workflow via a button.
Either option works - just having trouble finding said solution.
You have a few options:
- Create a webpart with the link in it. When the link is clicked, write an item to the list.
- If you're using SharePoint 2010, you can use the client object model to write an entry into the list using javascript (http://msdn.microsoft.com/en-us/library/ee537247.aspx)
- Use javascript to create a list item in the list (works with SharePoint 2007)(http://weblogs.asp.net/jan/archive/2009/04/10/creating-list-items-with-jquery-and-the-sharepoint-web-services.aspx)
Regarding the workflow option: If you're using SharePoint 2010, you can create a site workflow (this is important, list workflows require an item to exist in the list already) to write to the list. How to start a workflow programmatically: http://www.sharepointkings.com/2008/09/how-to-start-workflow-programmatically.html
Site URL/Lists/(list name)/NewForm.aspx?
the /NewForm.aspx? allows you to create a URL link to enter a new item in the list
We recently implemented something like this in SharePoint 2010 using the web part option that Kyle describes.
But before creating the web part, we tried the Circulation list from the new, out of the box Group Work feature. The concept is spot on, but its usage is pretty narrow (for example, to provide the document support you are looking for, the document would need to be added as an attachment to the list item). And its implementation does not lend itself to extensibility. It's a good first try and hopefully Microsoft will get it right in the next release. I only mention it just in case what it does today will fit your situation.
精彩评论