Yesterday I asked, where custom columns can come from. You helped me and told me that maybe it's event receiver. I created new event receiver and I added that try catch part:
(Of course I change ID's)
[Guid("fce84747-959a-4ea2-bcda-265d3675d207")]
public class LibrariesEventReceiver : SPFeatureReceiver
{
// Uncomment the method below to handle the event raised after a feature has been activated.
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
try
{
SPWeb web = properties.Feature.Parent as SPWeb;
SPSite rootSite = web.Site;
//AuthorizedUserGroup
Guid authorizedUserFieldGUID = Guid.Parse("38900A0D-4BF4-434C-B130-12D959E56E1D");
SPField authorizedUserField = rootSite.RootWeb.Fields[authorizedUserFieldGUID];
//Description
Guid descriptionGUID = Guid.Parse("b22207cd-d6de-4f0b-bdc4-6ea8a5b37714");
SPField description = rootSite.RootWeb.Fields[descriptionGUID];
}
catch (Exception)
{
throw;
}
}
}
}
However when I try deploy it, it fails:
Error occurred in deployment step 'Activate Features': Object reference not set to an instance of an object.
I have set features Scope: Web and I tried also Scope: Site, but I got same error message.
I comment out code and it seems that SPSite rootSite = web.Site; causes problem.
I used google last night and I didn't find answer. How I can fix this?
Sorry, that I need to ask help again here. I promise that this is not habit. :/