Ef þú færð “Site Content Type í notkun” Villa við eyðingu á efni gerð.
Breyta sjálfgefna efni gerð fyrir listann / bókasafn, sem notar þetta efni gerð.
Þá reyna að eyða efni gerð.
|
||||||
Site Content Tegund í notkun - Villa við eyðingu efnis TegundEf þú færð “Site Content Type í notkun” Villa við eyðingu á efni gerð.
Breyta sjálfgefna efni gerð fyrir listann / bókasafn, sem notar þetta efni gerð. Þá reyna að eyða efni gerð. 2 comments to Site Content Type in Use – Error while Deleting Content TypeSkildu eftir svar |
||||||
Copyright © 2024 MSTechBlogs - All Rights Reserved Powered by WordPress & Atahualpa |
How to find in which libraries this content type is used?
Refer to the discussion in my forum :
http://www.mstechblogs.com/Forums/viewtopic.php?f=8&p=12&sid=cee7f065bed1fc88d9759c66b373d4dd#p12
You can use Object Model to find :
með System;
með System.Collections.Generic;
með Microsoft.SharePoint;
namespace Test
{
class ConsoleApp
{
static void Main(band[] args)
{
með (SPSite siteCollection = new SPSite(“http://localhost”))
{
með (SPWeb webSite = siteCollection.OpenWeb())
{
// Get the obsolete content type.
SPContentType obsolete = webSite.ContentTypes[“Test”];
ef (obsolete != null) // We have a content type. usages = SPContentTypeUsage.GetUsages(obsolete);
{
IList
ef (usages.Count > 0) // It is in use.
{
Console.WriteLine(“The content type is in use in the following locations:”);
framhandleggur (SPContentTypeUsage usage in usages)
Console.WriteLine(usage.Url);
}
annars // The content type is not in use.
{
// Delete it.
Console.WriteLine(“Deleting content type {0}…”, obsolete.Name);
webSite.ContentTypes.Delete(obsolete.Id);
}
}
annars // No content type found.
{
Console.WriteLine(“The content type does not exist in this site collection.”);
}
}
}
Console.Write(“\nPress ENTER to continue…”);
Console.ReadLine();
}
}
}
Other Option would be using SQL query (beware its bit risky)
SELECT *
FROM AllUserData
WHERE (tp_DirName LIKE ‘%’)
OG ((tp_ContentType = ‘Document’) and tp_ListId=’C8723B19-0DAB-4F19-B195-3399D5375752′)
You will find items referenced by content type. Delete this referenced items using query below.
DELETE
FROM AllUserData
WHERE (tp_DirName LIKE ‘%’)
OG ((tp_ContentType = ‘Document’) and tp_ListId=’C8723B19-0DAB-4F19-B195-3399D5375752′)