0

機能の非アクティブ化時にコンテンツ タイプをプログラムで削除したいと考えています。削除を実行するコードを書きました:

 SPSecurity.RunWithElevatedPrivileges(delegate()
     {
        using (SPWeb webSite =(SPWeb)properties.Feature.Parent)
        {
            webSite.AllowUnsafeUpdates = true;
            // Get the obsolete content type.
            SPContentType obsolete = webSite.ContentTypes["Examples8888 - CT1"];

            // We have a content type.
            if (obsolete != null)
            {
                IList<SPContentTypeUsage> usages = SPContentTypeUsage.GetUsages(obsolete);

                // It is in use.
                if (usages.Count <= 0)
                {
                    obsolete.Delete();
                    // Delete it.
                    Console.WriteLine("Deleting content type {0}...", obsolete.Name);
                    webSite.ContentTypes.Delete(obsolete.Id);
                }
            }


        }
     });

しかし、それは私にエラーを与えます:

The content type is part of an application feature.

このコンテンツ タイプはどこでも使用されていませんが、削除できません。

このエラーに対処する方法はありますか?

ありがとう、プリヤ

4

1 に答える 1

0

すべての参照が削除され、すべてのごみ箱からも削除されていることを確認してください。

たとえば、リストが削除されたコンテンツ タイプを参照している場合、コンテンツ タイプはごみ箱に移動され、sharePoint は引き続き参照を認識します。すべてのごみ箱 (エンド ユーザーおよびサイト コレクション) から削除して、もう一度やり直してください。

于 2013-11-14T17:30:32.427 に答える