14 Juni 2012 18:45
Hi mates! First of all sorry for my bad english.
I tried to use a custom application page called CustomUpload.aspx to upload files to a SPLibrary. after upload all files i need to customize metadata from those files using another application page to apply a custom content type to that files receiving files id from querystring.
So, how can i obtain files id's from CustomUpload.aspx, cause file uploading is asynchronus and i cannot obtain any data from the files that i'm uploading?
Another way is to use CAML Query from the second page to obtain that id's but this solution is not 100% realiable.
Someone could help me? :)
Thanks a lot.
- Diedit oleh Ezeb88 14 Juni 2012 18:46
14 Juni 2012 19:07
1) find out logged in user
2) use CAML query on document library where "Created By" = "Logged In user"
3) Sort in descending order of "Created" datetime
4) read the first record and its ID ( this is the latest file user has uploaded).
Hope this helps you.
14 Juni 2012 19:34
If i don't find any solution i think that will use that way to solve the issue but it will be perfect if i can solve that problem using best practices.
Thanks a lot!
15 Juni 2012 2:59
When you upload your document you should have the components to build the Url of the new document. You can then send this url in the query string. Using the Url you can use SPWeb.GetFile() method. This method takes a Url as an argument. Now you can set the metadata for it.
- Ditandai sebagai Jawaban oleh Pengyu Zhao 22 Juni 2012 6:25