public async Task SaveItem(ListItem item)
        {
            using (var site = CreateSite(item.List.Web.Url))
            {
                using (var web = site.OpenWeb())
                {
                    await Task.Factory.StartNew(() =>
                    {
                        var serverList = web.Lists[item.List.Id];
                        var serverItem = serverList.GetItemById(item.Id);

                        foreach (var change in item.Changes)
                        {
                            serverItem[change.Key] = change.Value;
                        }

                        serverItem.Update();
                    });
                }
            }
        }
Esempio n. 2
0
        public async Task SaveItem(ListItem item)
        {
            await Task.Factory.StartNew(() =>
            {
                System.Threading.Thread.Sleep(2000);

                if (item.Id == 2) throw new Exception("Item save failed");
            });
        }