OVH Cloud OVH Cloud

document library path

2 réponses
Avatar
Info Path
Hi,

here's the context : I've got a document library in which I have some
subfolders. From a document url (in any subfolder), I need to retrieve the
document library path, is there a simple way to do this?
thanks,

cb

2 réponses

Avatar
Chris
lately Ive been working on an assembly container allowing document library to
use more than 1 event handler, and i needed to store a file at the root of
the library containing the infos of all event handler to use. Here is the
code allowing me to retrieve the root path of the library when a document is
inserted

SPWeb site = EventToDispatch.Site.OpenWeb();

SPFile FileInserted = site.GetFile(EventToDispatch.UrlAfter);

SPList list = site.Lists[FileInserted.ParentFolder.ContainingDocumentLibrary];

string assemblyDefinitionFile = site.Url + list.RootFolder.ServerRelativeUrl;

"Info Path" wrote:

Hi,

here's the context : I've got a document library in which I have some
subfolders. From a document url (in any subfolder), I need to retrieve the
document library path, is there a simple way to do this?
thanks,

cb





Avatar
Info Path
Thanks,
That was exactly what I needed.

"Chris" wrote in message
news:
lately Ive been working on an assembly container allowing document library
to
use more than 1 event handler, and i needed to store a file at the root of
the library containing the infos of all event handler to use. Here is the
code allowing me to retrieve the root path of the library when a document
is
inserted

SPWeb site = EventToDispatch.Site.OpenWeb();

SPFile FileInserted = site.GetFile(EventToDispatch.UrlAfter);

SPList list =
site.Lists[FileInserted.ParentFolder.ContainingDocumentLibrary];

string assemblyDefinitionFile = site.Url +
list.RootFolder.ServerRelativeUrl;

"Info Path" wrote:

Hi,

here's the context : I've got a document library in which I have some
subfolders. From a document url (in any subfolder), I need to retrieve
the
document library path, is there a simple way to do this?
thanks,

cb