In Sharepoint MOSS multiple users can edit the same item in a sharepoint list at the same time…the first person to save their edit “wins”.
Is there a way to prevent this, to lock the list item while it is being edited?
NB: This refers to a custom list -Not a document in a document library
Not possible - checkin/checkout is only supported for list items with an associated SPFile object (images, pages, documents - essentially everything that derives from SPDocumentLibrary)
-Oisin
There are a few ways to do that, all custom. As Oisin said on his post the native check-in/check-out engine needs a file associated.
Ideas:
Javascript
Modified EditForm.aspx file, embedded in a List Template, XmlHttpRequest checks for a "Checked-out Items List" repository, expires/remove the check after 10-20 minutes of inactivity from the user currently editing the file.
.NET
Event Handlers: I have not checked but the ItemUpdating Event Type could stop you from updating it if the Modified date changed since you opened the item, saying the item was modified while being edited and need to be updated (cloning the behavior of aspx/publishing pages in SharePoint)
Infopath
I noticed you said you dont have the enterprise version, still your users could have the InfoPath client on their machines and fill the form locally.
Now lets start the fun :)
Empty Document Template
You can hack your way to create a super "Add Item" button that uploads/creates a new Document Library Item with an empty document (.txt) and redirect the user directly to the Edit Properties form. I did this when I replaced the "Change Image" in the My Sites profile with a Document Library.
Word Document
Word 2007 can create documents similar to forms where the user can only fill the exact fields you want, so can excel (Infopath was created because users were using these programs for forms).
Related
When uploading a new document to the library, its a two step process. the document is considered "posted" as soon as step 1 is complete, but at that point in time none of the required fields has been uploaded yet, resulting in blank items showing.
Is there any way to stop upload document without filling required fields?
Thanks,
There are 2 things you can do here: simple and more advanced.
Simple step is to make your fields "Required". After file has beed uploaded the form will pop up and user will have to fill out fields. Although this will not remove the file uploaded, but it will alert user to fill the fields.
Advanced way is to create event receiver or workflow which would actually remove the file after some period if required fields are not filled out. Workflow option could be easier to create and you can do that in Sharepoint Designer
I am developing a database on Lotus Designer 8.5 environment with LotusScript and LotusFormula.
Is there any possibilities on get a list of recently opened documents (for example last five) in a Lotus Notes database ? My purpose is to provide an embedded view showing the recent documents opened by current user on the current database, which will act like some kind of history view.
Please advise
Use a folder categorized by username. Add the current document in PostOpen event to folder with document.PutInFolder(folderName) and remove the oldest document from folder with document.RemoveFromFolder(folderName)
This way you don't need to edit the documents and can show the last visited documents for a user in an embedded view.
As an alternative you can use user specific folders with option "Shared, private on first use".
I have that functionality in one of my databases.
I just added some code in the QueryOpen event of the form to store the UNID of the document in a profile document linked to the specific user. The values are stored in a multi value field, and my code removes the oldest entry when the number of entries I want to store is exceeded.
The user can actually set that number themselves in teh applications settings, 5 is default but they can make it more or less.
I built a class for this, makes it very easy to modify later, and to implement it in different forms, for different document types.
I then built a method to expose the last documents to the user, using a dropdown box as you can see below. Since you only wwant/need the five (or perhas ten) last documents, no need to use a view.
I have a SharePoint document library I am working on. It has a list of document sets. Each document set has a few fields that are marked as "Shared" so that they can be inherited by the documents inside.
When I upload a document inside a form opens and all the fields on the form are pre-filled with the shared values of the corresponding columns. But when I use create document from template, it opens the template in the corresponding Office application but the document property fields are empty and not read-only which is against the requirements of this project. I require them to be synced and filled exactly like when a document is uploaded.
There is one thing though. The user can fill any value he wants in those fields and they will still be saved a synced copy from parent in the library discarding what the user filled in, which is good, but why not show those values up in the document in the first place?
Anyone has experience in handling this please help. I have searched a lot on the internet but either my keywords are wrong or no one has had this problem before.
SharePoint version: 2010 Server
Office version: 2010 Professional
It sounds like you need a simple event reciever, which fire on itemadded. It would then go back up the tree to find the document set. Capture which properties are marked as shared. Adjust the item that is being added to force the values.
Probably 8 lines of code
I'm working on a SharePoint publishing site and I want to "log" all the changes made by users in a SharePoint list.
Some searches on the web guided me to the EventReceiver.
But my EventReceiver must be generic and attached to all lists in the site collection. The "log list" has several columns like the name of the list in which the event occurred, the name of the modified item, its old value and its new value.
Can someone guides me on how to achieve this?
There's already a provided answer for you on StackOverflow, hurrayy!!
It sounds possible. Create a class that inherits from SPItemEventReceiver and override ItemUpdating. You can use the following code to get the list:
using (SPWeb web = properties.OpenWeb())
{
SPList list = web.Lists[properties.ListId];
}
You can then use list to grab the list's title and URL. Next, compare each DictionaryEntry entry in properties.AfterProperties to the corresponding value in properties.ListItem to get your differences. Then save it to your log list. The trick would be automatically attaching your Event Receiver to each newly created list. Perhaps a timer job would work.
That said...
Before trying any of that, go to your site collection's Site Settings. Under Site Collection Administration, click Site collection audit settings. Under Specify the Document and Item events to audit, check Editing items. Only go with a custom solution if that does not give you what you need.
Would Version history not achieve the same functionality?
You can see what fields were changed by who and when. Though you would have to look at a list by list basis.
You can also access the version history information via the object model if you want to generate reports web part.
Otherwise using Janis Veinbergs link on how to attach a event handler to all lists and Rich Bennema method of getting the values from the updated item in a generic way, though I would use ItemUpdated as you don’t want to change the data that was updated only copy it to another location so there is no need to catch the data before it is submitted to the SharePoint database
Which is the best way to display a custom form for each new document being added to a specific document library?
I want the user to have some control over some actions that adding the document will cause - specifically, tasks created for users in a Task List, which the contributing user will have to OK before committing.
Is the best way to do this via a Workflow or an event handler?
Regards
Moo
For SharePoint server 2007:
A combination of a specialised content type and an event handler will give you the most control of the process (easier to debug too). A workflow is best for "easy" actions and is harder to make complex actions happen.
A workflow allows for more flexibility in assigning the workflow to different libraries by site admins.
Roll your content type and event handler into a feature that can be deployed. Assigning the content type to a list will allow you to take any data created by the standard form (remember you can create custom fields for really complex/custom data entry) and take any action required, including creating tasks based on the item.
Thanks for the answer, thats the route I was investigating but unfortunately I haven't found a way to make it work for Document Libraries - only Lists.
The problem I have come across is that aving a SPUtility.Redirect in the ItemAdded, ItemAdding, ItemCheckingIn or ItemCheckedIn event on the document library doesn't do anything at all, because there is no page related to the events - its all backend code being fired that is not linked to a web context, because its not the webpage doing the heavy lifting at that point but the Office integration.
All of the examples I have come across seem to rely on the fact that the EditForm.aspx or NewForm.aspx page is being displayed at the time the event is fired, which of course is not the case here.
This also leads to the problem that I cannot extend the EditForm.aspx or the CheckIn.aspx page to do what I want either, because Office 2007 circumvents both of these.
So, the only option left open to me at the moment is doing it through a workflow :/
Any further tips would be fantastic.
I may not understand your question, but is this close to what you're trying to do?
http://msdn.microsoft.com/en-us/library/ms550037.aspx
If not, in what way does this come up short?
A new "Content Type" with its New Form url set to the appropriate value should do the trick.
Unfortunately you may not be able to achieve what you are trying to with an Event Handler or a Workflow. You would ideally want the form to show up as soon as the user adds a new item to the library and a custom content type will do the trick.
Create a new Content Type. (Derive it from the existing Content Type)
Remove the default content type from the doc library.
Using the Object Model to set the New Form url to an aspx page or an Infopath form you've created.
Kind regards,