AnswerBun.com

Get the URL from the hyperlink column for workflow

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.

SharePoint Asked by M. Todd on December 25, 2020

2 Answers

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

Auto-populate email address from pc:Person?

1  Asked on December 17, 2020 by zeno

   

Org Browser start at a specific user for SP 2013

2  Asked on December 16, 2020 by brandon-black

     

Form based Login Authentication for Public Site Sharepoint online

1  Asked on December 8, 2020 by jitender-singh-tomar

   

Sharepoint PHP File Upload

1  Asked on December 7, 2020 by markvdb

     

CSS Script for Multiple Columns Boxed Style

1  Asked on December 6, 2020 by elebie

 

Faulting application name: csc.exe

2  Asked on December 4, 2020 by emaborsa

         

sharepoint 2013,RSS viewer web part error

1  Asked on December 4, 2020 by pasha

 

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved.