public ResourceSyncher(Guid siteId) { siteGuid = siteId; SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite(siteGuid)) { pCf = new WebSvcCustomFields.CustomFields(); pCf.Url = site.Url + "/_vti_bin/psi/customfields.asmx"; pCf.UseDefaultCredentials = true; cfDs = new WebSvcCustomFields.CustomFieldDataSet(); cfDs = pCf.ReadCustomFieldsByEntity(resEntity); psiLookupTable = new WebSvcLookupTables.LookupTable(); psiLookupTable.Url = site.Url + "/_vti_bin/psi/lookuptable.asmx"; psiLookupTable.UseDefaultCredentials = true; pResource = new WebSvcResource.Resource(); pResource.Url = site.Url + "/_vti_bin/psi/resource.asmx"; pResource.UseDefaultCredentials = true; //SPSecurity.RunWithElevatedPrivileges(delegate() //{ cn = new SqlConnection(EPMLiveCore.CoreFunctions.getConnectionString(site.WebApplication.Id)); cn.Open(); //}); } }); }
public ProjectWorkspaceSynch(Guid projectSiteGuid, string webUrl, Guid projectGuid, string username) { try { _username = username; mySite = new SPSite(projectSiteGuid); mySite.AllowUnsafeUpdates = true; cn = new SqlConnection(EPMLiveCore.CoreFunctions.getConnectionString(mySite.WebApplication.Id)); cn.Open(); mySiteToPublish = new SPSite(webUrl); myWebToPublish = mySiteToPublish.OpenWeb(); myWebToPublish.AllowUnsafeUpdates = true; pCf = new WebSvcCustomFields.CustomFields(); pCf.Url = mySite.Url + "/_vti_bin/psi/customfields.asmx"; pCf.UseDefaultCredentials = true; psiLookupTable = new WebSvcLookupTables.LookupTable(); psiLookupTable.Url = mySite.Url + "/_vti_bin/psi/lookuptable.asmx"; psiLookupTable.UseDefaultCredentials = true; psiProject = new WebSvcProject.Project(); psiProject.Url = mySite.Url + "/_vti_bin/psi/project.asmx"; psiProject.UseDefaultCredentials = true; psiResource = new WebSvcResource.Resource(); psiResource.Url = mySite.Url + "/_vti_bin/psi/resource.asmx"; psiResource.UseDefaultCredentials = true; projectUid = projectGuid; } catch (Exception ex) { myLog.WriteEntry("Error Loading Workspace Synch: " + ex.Message + ex.StackTrace, EventLogEntryType.Error, 401); } }