이것은 Sharepoint에서 처음입니다. 여기에 내가 나 또한 독립 실행 형 SharePoint 서버가 웹 응용 프로그램에서 Sharepoint 서버로 파일 업로드
- 입니다.
- 둘 다 다른 서버에 있습니다.
- 나는 셰어가 제공하는 웹 서비스 (CopyIntoItems) 셰어 포인트 웹 서비스의
- 사용 jQuery 라이브러리를 사용하여
- , 나는이 방법을 온라인으로 볼
셰어하는 웹 응용 프로그램에서 파일을 업로드해야
웹 검색 후 jQuery 부분이 작동하지 않을 것이라고 생각합니다.
나는 username/password를 사용하고 pdf 파일을 Sharepoint 서버에 업로드하는 방법을 찾고 있습니다. 업로드 시도하지만 오류에 종료되는 다음 내 C# 코드 내가이
UploadFile(@"C:\temp\uploadFile.txt", "http://spf-03:300/demo/Dokumente").ToString();
오류와 같은 위의 함수를 호출하고
public bool UploadFile(string file, string destination)
{
bool success = false;
CopySoapClient client = new CopySoapClient();
if (client.ClientCredentials != null)
client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
try
{
client.Open();
string filename = Path.GetFileName(file);
string destinationUrl = destination + filename;
string[] destinationUrls = { destinationUrl };
FieldInformation i1 = new FieldInformation { DisplayName = "Title", InternalName = "Title", Type = FieldType.Text, Value = filename };
FieldInformation[] info = { i1 };
CopyResult[] result;
byte[] data = File.ReadAllBytes(file);
//uint ret = client.CopyIntoItems(filename, destinationUrls, info, data, out result);
uint ret = client.CopyIntoItems(file, destinationUrls, info, data, out result);
if (result != null && result.Length > 0 && result[0].ErrorCode == 0)
success = true;
}
finally
{
if (client.State == System.ServiceModel.CommunicationState.Faulted)
client.Abort();
if (client.State != System.ServiceModel.CommunicationState.Closed)
client.Close();
}
return success;
}
는 내가 얻을 :
오류 코드 : 대상이 잘못되었습니다.
오류 메시지 : '복사'서비스 메서드는 대상 URL이 포함 된 동일한 도메인에서 호출되어야합니다.
답장을 보내 주셔서 감사합니다. 귀하의 접근 방식을 시도하고 지금 다음과 같은 오류가 발생합니다. 아마 보안 토큰 webservice가 작동하지 않습니다? 요청을 서버에서 처리 할 수 없습니다. ---> 클라이언트가 내부 오류로 인해 요청을 처리 할 수 없습니다. 오류에 대한 자세한 내용을 보려면 클라이언트가 서버로 예외 정보를 보내거나 Microsoft에 따라 추적을 사용하도록 IncludeExceptionDetailInFaults (ServiceBehaviorAttribute 또는 구성 동작을 통해)를 사용하십시오. NET Framework 3.0 SDK –