.NET Sharepointディレクトリの作成
-
20-08-2019 - |
質問
次のように、webclientと共有ポイントにファイルをアップロードできます
using (System.Net.WebClient webclient = new System.Net.WebClient())
{
System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(
Encryptor.Decrypt(ConfigurationManager.AppSettings["username"]),
Encryptor.Decrypt(ConfigurationManager.AppSettings["password"]),
ConfigurationManager.AppSettings["domain"]);
webclient.Credentials = credentials;
string path = Path.Combine("http://sharepoint.domain.com/dir", filename);
webclient.UploadData(path, "PUT", fileBytes);
}
しかし、ディレクトリが存在しない場合、ディレクトリを作成する方法がわかりません。
どのようにそれを行うことができますか?
ありがとう、 -c
解決
<!> quot; Directories <!> quot; SharePointサイトでは不正です。 SharePoint Webサービスの「ディレクトリ」構造は、SharePointデータベースにある仮想構造です。たとえば、「ディレクトリ」がSharePointオブジェクトモデルのどのオブジェクトであるかを識別する必要があります。 http://sharepoint.domain .com / dir はおそらくSPSiteです。このサイトでは、SPFolders、SPList、SPDocumentLibrariesなどの「ディレクトリ」を使用できます。
つまり、<!> quot;存在しないディレクトリを作成する場合<!> quot;つまり、SharePointサイトのディレクトリ構造では、WebClientを使用することはできません。 Windows SharePoint ServicesオブジェクトモデルとSharePoint Webサービスの2つのオプションがあります。
オブジェクトモデルは確かに使いやすいと思いますが、SharePointサーバーと同じサーバーでアプリを実行する必要があります。 Webサービスはもう少し手間がかかりますが、リモートで使用できます。
追加しようとしているオブジェクトの種類(SPFolder、SPSite、SPList、SPDocumentLibraryなど)を識別する必要があります。
ここにあるオブジェクトモデルを使用するための十分なドキュメントがありますこちら> a>ただし、Webサービスを使用する場合は、次の場所でアクセスする必要があります。
Administration Service http://<server-url:port-number>/_vti_adm/admin.asmx
Alerts Service http://<server-url>/_vti_bin/alerts.asmx
Document Workspace Service http://<server-url>/_vti_bin/dws.asmx
Forms Service http://<server-url>/_vti_bin/forms.asmx
Imaging Service http://<server-url>/_vti_bin/imaging.asmx
List Data Retrieval Service http://<server-url>/_vti_bin/dspsts.asmx
Lists Service http://<server-url>/_vti_bin/lists.asmx
Meetings Service http://<server-url>/_vti_bin/meetings.asmx
Permissions Service http://<server-url>/_vti_bin/permissions.asmx
Site Data Service http://<server-url>/_vti_bin/sitedata.asmx
Site Service http://<server-url>/_vti_bin/sites.asmx
Users and Groups Service http://<server-url>/_vti_bin/usergroup.asmx
Versions Service http://<server-url>/_vti_bin/versions.asmx
Views Service http://<server-url>/_vti_bin/views.asmx
Web Part Pages Service http://<server-url>/_vti_bin/webpartpages.asmx
Webs Service http://<server-url>/_vti_bin/webs.asmx
リストまたはドキュメントワークスペースサービスのサービスを確認することをお勧めします。
役立つこと。