public void DeleteFile(EUSiteSetting siteSetting, string fileResourceId) { Login(siteSetting.User, siteSetting.Password); AtomEntry entry = service.Get(DocumentsListQuery.documentsBaseUri + "/" + fileResourceId); entry.Delete(); }
/** Creates a new blog entry and sends it to the specified Uri */ static void PostAndDeleteNewDraftEntry(Service service, Uri blogPostUri) { Console.WriteLine("\nCreating a draft blog post"); AtomEntry draftEntry = null; if (blogPostUri != null) { // construct the new entry AtomEntry newPost = new AtomEntry(); newPost.Title.Text = "Marriage! (Draft)"; newPost.Content = new AtomContent(); newPost.Content.Content = "<div xmlns='http://www.w3.org/1999/xhtml'>" + "<p>Mr. Darcy has <em>proposed marriage</em> to me!</p>" + "<p>He is the last man on earth I would ever desire to marry.</p>" + "<p>Whatever shall I do?</p>" + "</div>"; newPost.Content.Type = "xhtml"; newPost.Authors.Add(new AtomPerson()); newPost.Authors[0].Name = "Elizabeth Bennet"; newPost.Authors[0].Email = "*****@*****.**"; newPost.IsDraft = true; draftEntry = service.Insert(blogPostUri, newPost); if (draftEntry != null) { Console.WriteLine(" New draft post created with title: " + draftEntry.Title.Text); // Delete the newly created draft entry Console.WriteLine(" Press enter to delete the draft blog post"); Console.ReadLine(); draftEntry.Delete(); } } }
/// <summary> /// Deletes the old tasks from GCal (all tasks prefixed with RM!). /// </summary> private void GoogleDelete() { query.Query = Utility.RM_TAG; EventFeed allTasks = Gcal.Query(query); for (int i = 0; i < allTasks.Entries.Count; i++) { AtomEntry task = allTasks.Entries[i]; task.Delete(); } }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>[Test] creates a new entry, saves and loads it back</summary> ////////////////////////////////////////////////////////////////////// [Test] public void DefaultHostInsertOneAndDelete() { Tracing.TraceMsg("Entering DefaultHostInsertOneAndDelete"); AtomEntry entry = ObjectModelHelper.CreateAtomEntry(1); Service service = new Service(); FeedQuery query = new FeedQuery(); service.RequestFactory = this.factory; int iCount = 0; string strTitle = "DefaultHostInsertOneAndDelete" + Guid.NewGuid().ToString(); entry.Title.Text = strTitle; query.Uri = new Uri(this.defaultHost); AtomFeed returnFeed = service.Query(query); iCount = returnFeed.Entries.Count; for (int i = 0; i < this.iIterations; i++) { Tracing.TraceMsg("DefaultHostInsertOneAndDelete, iteration : " + i); Stream s = service.EntrySend(new Uri(this.defaultHost), entry, GDataRequestType.Insert); s.Close(); returnFeed = service.Query(query); Assert.AreEqual(iCount + 1, returnFeed.Entries.Count, "feed should have one more entry now"); AtomEntry returnEntry = null; foreach (AtomEntry feedEntry in returnFeed.Entries) { if (String.Compare(feedEntry.Title.Text, strTitle) == 0) { // got him returnEntry = feedEntry; break; } } Assert.IsTrue(returnEntry != null, "did not find the just inserted entry"); returnEntry.Delete(); // query again and check count returnFeed = service.Query(query); Assert.AreEqual(iCount, returnFeed.Entries.Count, "feed has different number of entries as expected"); } }
static void DeleteComment(AtomEntry commentEntry) { Console.WriteLine("\nDeleting the comment"); if (commentEntry != null) { // Delete the comment. Console.WriteLine(" Press enter to delete the new comment post"); Console.ReadLine(); commentEntry.Delete(); } }
/** Delete the specified blog entry. */ static void DeleteEntry(AtomEntry toDelete) { Console.WriteLine("\nDeleting post"); // Delete the edited entry if (toDelete != null) { Console.WriteLine(" Press enter to delete the new blog post"); Console.ReadLine(); toDelete.Delete(); } }