Project Server에서 코드로 사용자 속성을 어떻게 수정합니까?
3036 단어 project
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Windows.Forms;
using System.Web.Services.Protocols;
using PSLibrary = Microsoft.Office.Project.Server.Library;
namespace Microsoft.Office.Project.Samples.UpdateResources
{
class Program
{
static void Main(string[] args)
{
const string PROJECT_SERVER_URI = "http://ServerName/ProjectServerName/";
const string RESOURCE_SERVICE_PATH = "_vti_bin/psi/resource.asmx";
try
{
// Set up the resource object and dataset
ResourceWebSvc.Resource resourceSvc = new ResourceWebSvc.Resource();
ResourceWebSvc.ResourceDataSet resourceDs = new ResourceWebSvc.ResourceDataSet();
resourceSvc.Url = PROJECT_SERVER_URI + RESOURCE_SERVICE_PATH;
resourceSvc.Credentials = CredentialCache.DefaultCredentials;
// Read read all the resources
resourceDs = resourceSvc.ReadResources(string.Empty, false);
// Check out the first resource for updating.
// - This assumes the resource is checked in.
// - An error occurs if the resource is already checked out.
resourceSvc.CheckOutResources(new Guid[] { resourceDs.Resources[0].RES_UID });
// Update the resource name of the first row.
Console.WriteLine ("Modifying resource " + resourceDs.Resources[0].RES_ID + " (" + resourceDs.Resources[0].RES_NAME + ")");
resourceDs.Resources[0].RES_NAME += " Modified at: " + DateTime.Now.ToShortTimeString();
// Send the update to the server and automatically check in the changed row
resourceSvc.UpdateResources(resourceDs, false, true);
}
catch (System.Web.Services.Protocols.SoapException ex)
{
string errMess = "";
PSLibrary.PSClientError error = new PSLibrary.PSClientError(ex);
PSLibrary.PSErrorInfo[] errors = error.GetAllErrors();
for (int j = 0; j < errors.Length; j++)
errMess = errMess + errors[j].ErrId.ToString() + "
";
errMess = errMess + "
" + ex.Message.ToString();
MessageBox.Show(errMess, "Error", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
catch (WebException ex)
{
string message = ex.Message.ToString() +
"
Log on, or check the Project Server Queuing Service";
MessageBox.Show(message, "Project Creation Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Personal analysis of the Daily project on GitHubAnalysis of other people's projects on github. Learn from him well. https://github.com/spring2613/Daily The project has ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.