1

I am using SharePoint 2013,

I have used email functionality in the site which will be triggered by code (not workflow), the content of the email should be fetched from an list column. That list column is having an hyperlink. The hyperlink will be point to the sites home page. But whenever i give absolute url to the hyperlink it is getting changed to relative url.

This is causing problem in my email. Because in my email, i am getting not getting the complete URL.

Can someone help me, how to use absolute url in the sharepoint list column value.

1

Instead of using a list column you can use following code. This will always return absolute URL of current site where the code is running.

SPContext.Current.Site.RootWeb.Url

Image of VS Description

  • But as per the requirement, i have to use list column only. – satheesh Aug 10 '17 at 11:21
  • This is the problem with SharePoint. Even you provide Absolute URL and the domain is same as your web application, it will convert the URL to relative URL. You can see this in Welcome Page, put absolute URL and after saving it becomes relative URL or same with Navigation. For such case instead of using hyperlink or picture column, use single line of text column – ThinkB4Code Aug 10 '17 at 12:00
  • Otherwise you said you are triggering mail from Code, so why to use an extra storage field for storing the URL when you can get it programmatically? Any specific reason for this? – ThinkB4Code Aug 10 '17 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.