views:

976

answers:

3

I have a custom infopath workflow which allows users to submit expesne reports. Whenever someone submits an expense report in the Forms Library the workflow is initiated. The workflow checks the weburl and using a generic method creates a link to point to the workflow item and sends this link in a mail to the submitter and approvers.

Now what i want to achieve is that i need a way to point to the workflow item using a public url so even if the user is submitting a request from intranet or internet the link will be pointing to the internet url and hence the users can open items from their mailbox using internet url when the intranet is not available.

So i guess in short i need a way to get the public url for a site. Also keeping in mind that site may be extended for internet with some security settings in place. What would be the easiest and most efficient way to do this.

A: 

If I understand what you are attempting, you want an internet accessible method to access a SharePoint workflow object. Correct me if I am wrong.

Here is what I would do: I would set up a simple website w/ DNS that has a single page that exposes the workflow object. That way, you can just use this site as the base for the link in the notification.

Example: I have an HTML forms engine that I wrote a while back. A customer just requested that it be accessible on the internet as well. I created a new site in IIS, reverse proxied the IP address, and voila, my intranet application is exposed to the internet. Of course, there are security issues and small intranet caviats that had to be taken care of, but nothing too major.

Hope that helps.

theG
+1  A: 

Relative path of you Page or the Link will be same irrespective of the Zone from which the user access the Site. All you need to change in the URL is the host name part.

You can get the URL for any Zone with the Following code

SPContext.Current.Site.WebApplication.GetResponseUri(Microsoft.SharePoint.Administration.SPUrlZone.Default).AbsoluteUri
Kusek
+1  A: 

You can make sure you always get URLs from a specific zone by creating a new SPSite object and specifying the zone for it in the constructor. In your case you could try with the Default zone (SharePoint uses URLs from this zone when sending emails for example) or the Internet zone. You have a small sample below:

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
}
Soda