概要
<properties>
要素の <add>
要素は、プロパティ ストア プロバイダーへの XML 名前空間のマッピングを定義します。
Note
WebDAV は、次の 2 種類のプロパティを定義します。
- 「ライブ」プロパティ: これらのプロパティは、基になるファイル システムに存在します。 たとえば、ファイル名とファイル サイズです。 これらのプロパティは、常にサポートされます。
- 「デッド」プロパティ: これらのプロパティはユーザー定義であり、プロパティ ストアに格納されます。 たとえば、ドキュメントの作成者や使用されているテンプレートです。
「デッド」プロパティを使用するには、<properties>
要素の allowCustomProperties
を true に設定し、<propertyStores> コレクションで定義されているプロパティ プロバイダーの一覧から XML 名前空間からプロパティ プロバイダーへのマッピングを定義する必要があります。
互換性
バージョン | メモ |
---|---|
IIS 10.0 | <add> 要素は IIS 10.0 では変更されませんでした。 |
IIS 8.5 | <add> 要素は IIS 8.5 では変更されませんでした。 |
IIS 8.0 | <add> 要素は IIS 8.0 では変更されませんでした。 |
IIS 7.5 | <properties> 要素の <add> 要素は、IIS 7.5 の機能として付属しています。 |
IIS 7.0 | <properties> 要素の <add> 要素は、WebDAV 7.0 で導入され、IIS 7.0 用の別個のダウンロードでした。 |
IIS 6.0 | 該当なし |
段取り
Web サーバーの WebDAV 発行をサポートするには、WebDAV モジュールをインストールする必要があります。 そのためには、次のステップに従います。
Windows Server 2012 または Windows Server 2012 R2
- タスク バーで [サーバー マネージャー]をクリックします。
- [サーバー マネージャー] で、[管理] メニューを選択し、[役割と機能の追加] を選択します。
- [役割と機能の追加] ウィザードで、[次へ] をクリックします。 インストールの種類を選択し、[次へ] をクリックします。 対象サーバーを選択し、[次へ] をクリックします。
- [サーバー ロール] ページで、[Web サーバー (IIS)]、[Web サーバー]、[HTTP 共通機能] の順に展開し、[WebDAV 発行] を選択します。 次へ をクリックします。
- [機能の選択] ページで、[次へ] をクリックします。
- [インストール オプションの確認] ページで、[インストール] をクリックします。
- [結果] ページで、 [閉じる]をクリックします。
Windows 8 または Windows 8.1
- [スタート] 画面で、ポインターを左下隅まで移動し、[スタート] ボタンを右クリックし、[コントロール パネル] をクリックします。
- [コントロール パネル]で [プログラムと機能] をクリックし、[Windows の機能の有効化または無効化] をクリックします。
- [インターネット インフォメーション サービス]、[World Wide Web サービス]、[HTTP 共通機能] を順に展開して、[WebDAV 発行] を選択します。
- OK をクリックします。
- 閉じるをクリックします。
Windows Server 2008 R2
- タスク バーで [スタート] をクリックし、[管理ツール] をポイントして、[サーバー マネージャ] をクリックします。
- [サーバー マネージャ] 階層ウィンドウで [役割] を展開し、[Web サーバー (IIS)] をクリックします。
- [Web サーバー (IIS)] ウィンドウで、[役割サービス] セクションまでスクロールし、[役割サービスの追加] をクリックします。
- [役割サービスの追加] ウィザードの [役割サービスの選択] ページで、[HTTP 共通機能] を展開し、[WebDAV 発行] を選択して [次へ] をクリックします。
- [インストール オプションの確認] ページで、[インストール] をクリックします。
- [結果] ページで、 [閉じる]をクリックします。
Windows 7
- タスク バーで、[スタート]、[コントロール パネル] の順にクリックします。
- [コントロール パネル]で [プログラムと機能] をクリックし、[Windows の機能の有効化または無効化] をクリックします。
- [インターネット インフォメーション サービス]、[World Wide Web サービス]、[HTTP 共通機能] の順に展開します。
- [WebDAV 発行] を選択し、[OK] をクリックします。
Windows Server 2008 または Windows Vista
次の URL からインストール パッケージをダウンロードします。
次のチュートリアルの手順に従って、WebDAV モジュールをインストールします。
操作方法
Web サイトの WebDAV プロパティを構成する方法
インターネット インフォメーション サービス (IIS) マネージャーを開きます。
Windows Server 2012 または Windows Server 2012 R2 を使用している場合:
- タスク バーで、[サーバー マネージャー] をクリックし、[ツール]、[インターネット インフォメーション サービス (IIS) マネージャー] の順にクリックします。
Windows 8 または Windows 8.1 を使用している場合:
- Windows キーを押しながら文字 X を押し、[コントロール パネル] をクリックします。
- [管理ツール] をクリックし、[インターネット インフォメーション サービス (IIS) マネージャー] をダブルクリックします。
Windows Server 2008 または Windows Server 2008 R2 を使用している場合:
- タスク バーで、[スタート] ボタンをクリックし、[管理ツール]、[インターネット インフォメーション サービス (IIS) マネージャー] の順にクリックします。
Windows Vista または Windows 7 を使用している場合:
- タスク バーで、[スタート]、[コントロール パネル] の順にクリックします。
- [管理ツール] をダブルクリックし、[インターネット インフォメーション サービス (IIS) マネージャー] をダブルクリックします。
[接続] ウィンドウでサーバー名を展開し、[サイト] ノードを展開してから、サイトの名前をクリックします。
サイトの [ホーム] ウィンドウで、[WebDAV Authoring Rules] (WebDAV オーサリング規則) をダブルクリックします。
[WebDAV オーサリング規則] ページが表示されたら、[操作] ウィンドウで [WebDAV 設定] をクリックします。
[WebDAV 設定] ページが表示されたら、[プロパティの動作] セクションで次のオプションを指定します。
[匿名プロパティの照会を許可] を [False] に設定します。
[カスタム プロパティを許可する] を [True] に設定します。
[無限の深さのプロパティ クエリを許可する] を [False] に設定します。
省略記号 (...) ボタンを選択して名前空間コレクション エディターを起動します。
[追加] を選択し、ドロップダウン リストから webdav_simple_prop を選択します
XmlNameSpace に "*" を指定し、[OK] を選択します。
前の手順を完了したら、[操作] ウィンドウで [適用] をクリックします。
構成
<properties>
要素は、ApplicationHost.config ファイルのサイト レベルでのみ構成できます。 他のレベルまたは Web.config ファイル内の <properties>
要素は無視されます。
属性
属性 | 説明 |
---|---|
xmlNamespace |
必須の文字列属性です。 マッピングの XML 名前空間を指定します。 注意: ワイルドカード "*" 文字は既定の名前空間マッピングを定義するために使用され、一意のマッピングを持たない名前空間ではワイルドカード マッピングが使用されます。 WebDAV クライアントが、特定の名前空間マッピングがなく、ワイルドカード マッピングが存在しない XML 名前空間を使用している場合、プロパティを格納できません。 既定値は false です。 |
propertyStore |
必須の文字列属性です。 マッピングのプロパティ ストアを指定します。 注意: プロパティ ストアの名前は、<propertyStores> コレクションで定義する必要があります。 既定値は false です。 |
子要素
なし。
構成サンプル
次の例では、既定の Web サイトのサンプル <webdav>
要素を表示します。 次の使用例は、既存のオーサリング規則をクリアし、管理者グループに対して 1 つの規則を追加し、WebDAV オーサリングを有効にし、隠しファイルを許可し、WebDAV ロックを有効にしてロック プロバイダーを指定し、WebDAV プロパティを有効にし、プロパティ マッピングの既定の XML 名前空間を指定します。
<___location path="Default Web Site">
<system.webServer>
<webdav>
<authoringRules defaultAccess="none" allowNonMimeMapFiles="true" defaultMimeType="text/plain">
<clear />
<add roles="administrators" path="*" access="Read, Write, Source" />
</authoringRules>
<authoring enabled="true" requireSsl="false">
<fileSystem allowHiddenFiles="true" />
<locks enabled="true" lockStore="webdav_simple_lock" requireLockForWriting="false" />
<properties allowAnonymousPropfind="false" allowInfinitePropfindDepth="false" allowCustomProperties="true">
<clear />
<add xmlNamespace="*" propertyStore="webdav_simple_prop" />
</properties>
</authoring>
</webdav>
</system.webServer>
</___location>
サンプル コード
次の例では、匿名と無限の両方の深度プロパティ クエリが無効になるように WebDAV プロパティ設定を構成し、組み込みの webdav_simple_prop プロバイダーにマップされた既定の XML 名前空間でカスタム プロパティを有効にします。
AppCmd.exe
appcmd.exe set config "Default Web Site" -section:system.webServer/webdav/authoring /properties.allowAnonymousPropfind:"False" /commit:apphost
appcmd.exe set config "Default Web Site" -section:system.webServer/webdav/authoring /properties.allowInfinitePropfindDepth:"False" /commit:apphost
appcmd.exe set config "Default Web Site" -section:system.webServer/webdav/authoring /properties.allowCustomProperties:"True" /commit:apphost
appcmd.exe set config "Default Web Site" -section:system.webServer/webdav/authoring /+"properties.[xmlNamespace='*',propertyStore='webdav_simple_prop']" /commit:apphost
Note
AppCmd.exe を使用してこれらの設定を構成するときは、commit パラメーターを必ず apphost
に設定する必要があります。 これで、ApplicationHost.config ファイルの適切な場所セクションに構成設定がコミットされます。
C#
using System;
using System.Text;
using Microsoft.Web.Administration;
internal static class Sample
{
private static void Main()
{
using (ServerManager serverManager = new ServerManager())
{
Configuration config = serverManager.GetApplicationHostConfiguration();
ConfigurationSection authoringSection = config.GetSection("system.webServer/webdav/authoring", "Default Web Site");
ConfigurationElement propertiesElement = authoringSection.GetChildElement("properties");
propertiesElement["allowAnonymousPropfind"] = false;
propertiesElement["allowInfinitePropfindDepth"] = false;
propertiesElement["allowCustomProperties"] = true;
ConfigurationElementCollection propertiesCollection = propertiesElement.GetCollection();
ConfigurationElement addElement = propertiesCollection.CreateElement("add");
addElement["xmlNamespace"] = @"*";
addElement["propertyStore"] = @"webdav_simple_prop";
propertiesCollection.Add(addElement);
serverManager.CommitChanges();
}
}
}
VB.NET
Imports System
Imports System.Text
Imports Microsoft.Web.Administration
Module Sample
Sub Main()
Dim serverManager As ServerManager = New ServerManager
Dim config As Configuration = serverManager.GetApplicationHostConfiguration
Dim authoringSection As ConfigurationSection = config.GetSection("system.webServer/webdav/authoring", "Default Web Site")
Dim propertiesElement As ConfigurationElement = authoringSection.GetChildElement("properties")
propertiesElement("allowAnonymousPropfind") = False
propertiesElement("allowInfinitePropfindDepth") = False
propertiesElement("allowCustomProperties") = True
Dim propertiesCollection As ConfigurationElementCollection = propertiesElement.GetCollection
Dim addElement As ConfigurationElement = propertiesCollection.CreateElement("add")
addElement("xmlNamespace") = "*"
addElement("propertyStore") = "webdav_simple_prop"
propertiesCollection.Add(addElement)
serverManager.CommitChanges()
End Sub
End Module
JavaScript
var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var authoringSection = adminManager.GetAdminSection("system.webServer/webdav/authoring", "MACHINE/WEBROOT/APPHOST/Default Web Site");
var propertiesElement = authoringSection.ChildElements.Item("properties");
propertiesElement.Properties.Item("allowAnonymousPropfind").Value = false;
propertiesElement.Properties.Item("allowInfinitePropfindDepth").Value = false;
propertiesElement.Properties.Item("allowCustomProperties").Value = true;
var propertiesCollection = propertiesElement.Collection;
var addElement = propertiesCollection.CreateNewElement("add");
addElement.Properties.Item("xmlNamespace").Value = "*";
addElement.Properties.Item("propertyStore").Value = "webdav_simple_prop";
propertiesCollection.AddElement(addElement);
adminManager.CommitChanges();
VBScript
Set adminManager = createObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set authoringSection = adminManager.GetAdminSection("system.webServer/webdav/authoring", "MACHINE/WEBROOT/APPHOST/Default Web Site")
Set propertiesElement = authoringSection.ChildElements.Item("properties")
propertiesElement.Properties.Item("allowAnonymousPropfind").Value = False
propertiesElement.Properties.Item("allowInfinitePropfindDepth").Value = False
propertiesElement.Properties.Item("allowCustomProperties").Value = True
Set propertiesCollection = propertiesElement.Collection
Set addElement = propertiesCollection.CreateNewElement("add")
addElement.Properties.Item("xmlNamespace").Value = "*"
addElement.Properties.Item("propertyStore").Value = "webdav_simple_prop"
propertiesCollection.AddElement(addElement)
adminManager.CommitChanges()