none
[SharePoint 2013] How to remove SPWorkItem in database RRS feed

  • Discussion générale

  • Hello,

    I would like to remove all SPWorkitem already created.

    Here is my sql request to see them:

    select * from [WSS_Content].[dbo].[ScheduledWorkItems]

    I tried different things (in same time):

    using (SPSite site = new SPSite("http://srv-sp2k13ad"))
                {
    
                    SPWorkItemCollection items = new SPWorkItemCollection(site, new Guid("{257A8273-7324-40E8-81D3-45355F0EBD81}"));
    
                    uint rows, columns;
                    object workerItemsObject;
                    items.GetType().GetProperty("GetAllWorkItems", BindingFlags.NonPublic | BindingFlags.Instance).GetSetMethod(true).Invoke(items, new object[] { true });
                    site.GetWorkItems(items, out columns, out rows, out workerItemsObject);
    
    //First try
                    items.DeleteInProgressWorkItems(Guid.Empty, new Guid("{257A8273-7324-40E8-81D3-45355F0EBD81}"), Guid.Empty);
    //second try
                    items.RevertInProgressWorkItems(Guid.Empty, Guid.Empty, new Guid("{257A8273-7324-40E8-81D3-45355F0EBD81}"), Guid.Empty, true);
                    foreach (SPWorkItem i in items)
                    {
    //Third try
                        items.DeleteWorkItem(i.Id);
                    }
                }

    They still in my database. Any Idea?

    Regards,

    Julien Dufour


    mercredi 23 octobre 2013 14:51

Toutes les réponses