November Happy Hour will be moved to Thursday December 5th.

Check if a file is referenced by a Page

Vote:
 

Hi,

I'm doing a search for files in Documents, and wonder if it's possible to check if a found file is referenced by a Page, and of course, which page it is. When you try to delete or move a file in the File Manager you get a warning if the file is referenced by a Page, so I suppose it could be done in code-behind?

// Kind regards, Torbjörn

#36438
Jan 28, 2010 12:15
Vote:
 

Hi

Yes, you can do so by using the SoftLink class. Use SoftLink.Load and you should get a collection of softlinks where you can see what pages are referencing that file.

Regards

Per Gunsarfs
EPiServer development team

#36439
Jan 28, 2010 13:46
Vote:
 

Hi,

That's really smooth, thanks a lot, Per.

Made my code cleaner and faster, since my initial solution was to fetch a PageDataCollection and loop through it .

// Regards, Torbjörn 

#36452
Jan 28, 2010 19:41
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.