TransWikia.com

Get the URL from the hyperlink column for workflow

SharePoint Asked by M. Todd on December 25, 2020

I have list with 500+ records. There is a hyperlink column called “TargetURL”. As all of us know SP saves hyperlink in [“http://portal.site.com/sitecoll/doclib/Forms/someview.aspx”, description ] format.

I have a workflow and I need to extract the doclib portion from the URL segment so I can get the document library name. Possible?

Substring? but how ? any tips will be appreciated.

2 Answers

This worked for me but I had to put first result in a variable and then add another build string action

http://[^/]+/[^/]+/

http://portal.cab.com/SalessiteCollection/October2012Library/Forms/customview.aspx Result: October2012Library/Forms/customview.aspx (you can store this in a variable)

(/Forms.*)

October2012Library/Forms/customview.aspx Result: October2012Library

Correct answer by Bill Baer on December 25, 2020

Yes,

Have you tried this?

SPWeb web = SPContext.Current.Web;
string listname = String.Empty;
try
{
    SPList list = web.GetList(HttpContext.Current.Request.RawUrl);
    if (null != list)
    {
        listname = list.Title;
    }
}
catch (System.IO.FileNotFoundException ex) 
{
    //... Handle the exception 
}

Answered by Daniel Pinto on December 25, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP