views:

318

answers:

2

Throughout my SharePoint site, I have several document repositories that are tied to primary keys from an external database. I have added custom columns in the document library metadata fields so that we will know which SharePoint documents correspond with which table entries. As a requirement, we need to have document uploads that have these fields automatically populated. For instance, I'd like to have the following url:

./Upload.aspx?ClassID=2&SystemID=63

So that when you upload any documents to this library, it automatically adds the ClassID and SystemID values to the corresponding ClassID and SystemID columns outlined in the SharePoint document library fields.

Is there any quick or easy way to do this, or will I have to completely rewrite the Upload.aspx script from scratch?

A: 

I think the only way to go is to create your own Upload.aspx page. Read more here.

Colin
That page seems to be specifically for changing just the menu. The post was created so that you could change the menu to point to a custom upload page, not actually customize the upload content. What they do is extend the menu class. Maybe there's a way to extend the classes that generate the main form so I could add hidden fields?For adding a document to a library in a customized script, I found this:http://stackoverflow.com/questions/468469/how-do-you-upload-a-file-to-a-document-library-in-sharepointI still haven't figured out how to manually set one of the metadata columns.
Corey O.
A: 

Unfortunately, it looks like going custom is the only option for now. Here are some tips on how to code the submission page.

There is a corresponding entry that describes how to add a document to a document library here:

http://stackoverflow.com/questions/468469/how-do-you-upload-a-file-to-a-document-library-in-sharepoint

Likewise, once you have a document library file handler, you can alter its metadata column values using this method:

http://www.davehunter.co.uk/Blog/Lists/Posts/Post.aspx?List=f0e16a1a-6fa9-4130-bcab-baeb97ccc4ff&ID=109

Essentially it's just

SPFile.Item["ColumnName"] = "Value";

Corey O.