AnswerBun.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!

Related Questions

Create Folder and Upload File to Document Library

1  Asked on November 21, 2021 by chris-harrington

       

How to create list to track documents uploaded

1  Asked on November 17, 2021 by bstock

       

when try to open a MS project file, getting an issue.

2  Asked on November 15, 2021 by achiever-sp

 

Content Search WebPart: query Date and Time field

2  Asked on November 13, 2021 by akshay-dattatray-nangare

     

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir