Reputation: 12346
Is there are way to progammatically determine the root directory's local path of the current sharepoint site?
Best Regard
Oliver Hanappi
Upvotes: 1
Views: 6487
Reputation: 28325
You can determine the physical local path of the Web Application by querying the IisSettings colelction on your site.
Such as this:
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
namespace WSStest
{
class Program
{
static void Main(string[] args)
{
using (SPSite site = new SPSite("http://<YOURSITE>"))
{
string localPath = site.WebApplication.IisSettings[SPUrlZone.Default].Path.ToString();
Console.WriteLine("Local path: " + localPath);
}
}
}
}
Upvotes: 5