none
How to judge whether a file was created by "create document workspace" command RRS feed

  • Question

  • Hi,
    How to judge whether a file was created by "send to -> create document workspace" context menu command in a WorkSpace site document library?

    I use the following code but today find it was wrong.

     if (currentItem.File.ServerRelativeUrl.Length != (currentItem.File.Url.Length + 1)){ 
     // 
     // for example:
     // a file(say, a.doc) in root web document library(url: http://root/shared documents) is sent to sub workspace web(url:http//root/workspace/shared documents)
     // I want to know a file (a.doc) in workspace web's document library is sent from root web.
     // I get the currentItem which is a SPListItem object represent the a.doc in workspace web.
     // I found some thing like this: 
     // currentItem.ServerRelativeUrl="/workspace/shared documents/a.doc"
     // currentItem.Url="shared documents/a.doc"
     //
     // If review a.doc in root web's shared ducuments,
     // aDotDoc_item.ServerRelativeUrl="/shared documents/a.doc"
     // aDotDoc_item.Url="shared documents/a.doc"
     //
      // It seems aDotDoc_item.ServerRelativeUrl.Length==aDotDoc_item.Url.Length+1
     // but currentItem is not.
     //
     // Now I found this is not true. Because any file in a WorkSpace type Web site all have ServerRelativeUrl and Url properties like currentItem.
     
    }


    Any help is appreciated!



    Monday, April 18, 2011 8:41 AM

Answers

  • To get a list item source url , GetItemByIdSelectedFields method must be used and "_SourceUrl" must be passed to it. Incredibly, I had ever thought of such a simple method before.
    • Marked as answer by ThinkBox Monday, April 18, 2011 10:43 PM
    Monday, April 18, 2011 10:43 PM