Որպեսզի աշխատանքի շուրջ KPI խնդիրը Ես գրել այստեղ:, I did some testing and discovered that KPI’s work against folders with meta data in the same way that they work against documents or list items. I proved it out by creating a new content type based on the folder content type and then added a few fields. I created some indicators and proved to myself that KPIs work as expected. This was welcome news. It’s not perfect, because the drill-down you get from the KPI against the folders is not exactly what you want. This isn’t too much a drawback in my case because 1) Վերջ օգտվողները չգիտեմ որեւէ ավելի ու 2) the drill-down goes to a folder. They click the folder name and they are at the item. It’s two clicks instead of one, որը ոչ թե աշխարհի վերջը.
This flowed nicely with the work I was doing. I am creating a folder for every document that gets uploaded. This is done via an event receiver. Արդյունքում, դա մի կտոր տորթ պահել ծնող պահոցը ի meta data in sync with the KPI-driven meta data from the file itself since the plumbing is already in place. Սա թույլ է տալիս ինձ, որ իմ KPI եւ ուտել նրանց էլ 🙂
I modified the event receiver to add the folder and then set this new folder’s content type to my custom KPI-friendly content type. This bit of code did the trick:
SPFolderCollection srcFolders = targetWeb.GetFolder("Documents").SubFolders; SPFolder addedFolder = srcFolders.Add(properties.ListItem.ID.ToString());
SPContentTypeId kpiCT = նոր SPContentTypeId("0x0120002A666CAA9176DC4AA8CBAA9DC6B4039F"); addedFolder.Item["Content Type ID"] = KpiCT; addedFolder.Item.Update();
To կմնա փաստացի Content type ID-ն, I մուտք, որ բովանդակության տեսակը միջոցով Տեղում պարամետրերով եւ տետրերի / pasted այն է հղում ինչպես ցուցադրված է:
</վերջ>