Obtaining (publicly available) Internet URL for the Sharepoint portal site

I have a custom infopath workflow that allows users to send expesne reports. Whenever someone submits an expense report to the form library, the workflow begins. The workflow validates Weburl and uses the general method to create a link that points to a workflow element and mail the link to the sender and approver.

Now what I want to achieve is that I need a way to point to a workflow element using a public URL, so even if a user sends a request from an intranet or the Internet, the link will point to the Internet URL and, therefore, users can open items from their mailbox using an Internet address when the intranet is unavailable.

So, I think, in short, I need a way to get the public URL for the site. Also remember that a site can be expanded for the Internet with some in-place security settings. What will be the easiest and most effective way to do this.

+3
source share
3 answers

, , . , URL-, .

URL-

SPContext.Current.Site.WebApplication.GetResponseUri(Microsoft.SharePoint.Administration.SPUrlZone.Default).AbsoluteUri
+3

URL- , SPSite . (SharePoint URL- , ) . :

using(SPSite site = new SPSite(currentSiteId, SPUrlZone.Default)
{
    string publicUrl = site.MakeFullUrl(serverRelativeUrl);
    // note that MakeFullUrl takes a server relative url not a site relative one
}
+2

, , , SharePoint. , .

: - DNS, , . , .

: HTML-, . , . IIS, IP- voila, . , , , .

, .

0

Source: https://habr.com/ru/post/1705903/


All Articles