0

I'm building a sln for managing projects. A site will be created for each project. Each project has a projectId, and is also related to a CustomerID, and a OrderId. The project site includes a document library.

My question is what metadata to include in the document contenttype used in that library.

Option1: Include projectid, customerid and orderid in the contentype.
+ This will make it easier later when searching for documents.
- Boring for the customer to add that metadata for everydocument.

Option2: Include none of the ids in the metadata.
+ Faster to add new document
- Difficult to later find, say all documents for a given customer

Option3: Include projectid, customerid and orderid in contenttype, but make the "new forms" fill out that metadata by default
+ Same as option1
- Don't know how to implement...(the projectid is part of the url, so I can grab it. And I can store the customerId, and orderid somewhere in the site..., but still, how can I make them be readonly and filled out by default?)

Thanks for any suggestions

Larsi

3 Answers 3

1

There are a few options to auto-populate the metadata.

Write server-side code:

Using Visual Studio, create an ItemAdded event receiver. In there you can access values from the url as well as data stored in your site.

Customize your form in SharePoint Designer:

Use client-side code to populate your columns. Here ia a JavaScript library to help you and the page include a link that explains how to populate from a value in the url. I have not used this code, but it was posted by one of the moderators of this site.

I'm not clear on your logic for determining which customer and order to assign though. If these are Choice fields, then you'll have dropdown lists on the form whose values come from a Customer list and Order list on your site. Another option is to use the new managed metadata column, which is very user-friendly.

1

My opinion is to include the metadata. If the files need to be found later, utilizing metadata makes it a no brainer. You can use views and search scopes to find information easily. If you don't, you're hamstringing yourself.

You could use some client side scripting on the EditForm of the document library, this is where you get redirected to after you've uploaded a file. If you pass along query string parameters, you can parse that, and set the field values.

To make it easier on the end users, you could only require 1 piece of metadata, and use a workflow to set the other pieces of metadata, most likely projectid. From that, you should be able to decipher the customerid and orderid right?

1

We do this by storing the id's in the SPSite.RootWeb's PropertyBag (SPWeb.SetProperty) on site creation.

If needed, you can auto fill any metadata associated with content added to the site by accessing these values in an ItemEventReceiver.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.