IMAP bibliteka - nie działa metoda Delete Message

0

Cześć.
Mam problem chyba z niepoprawnym parametrem podawanym do metody Delete Massage
którą chciałbym użyć do usuwania wiadomości z serwera pocztowego

oto kod obiektu z wykomentowaną linią użycia metody DeleteMessage() której nie mogę uruchomić aby skutecznie usunęła mi jakąś wiadomość na serwerze pocztowym:

  private static IEnumerable<MailMessage> GetMessages()
        {
            using (ImapClient client = new ImapClient(imapHost, 993, true))
            {
                Console.WriteLine("Connected to " + imapHost + '.');
                //
                // Login
                client.Login(imapUser, imapPassword, AuthMethod.Auto);
                Console.WriteLine("Authenticated.");
                //
                // Get a collection of all unseen messages in the INBOX folder
                client.DefaultMailbox = "INBOX";
                //
                IEnumerable<uint> uids = client.Search(SearchCondition.Seen());//.Unseen());
                // Seen: 77 new email message(s).
                int asd = uids.Count();
                //
                if (uids.Count() == 0)// ano rzeczywiście tutaj jest com sobie powyżej niby że odkrył... trochę że se pogłówkować musiał byl...
                    return null;
                //
               // client.DeleteMessage(uids);// 3);//,"INBOX");

                //
                return client.GetMessages(uids);
            }
        }

oto kod z projektu biblioteki ( www.S22.Imap 3.6.0 na Nuget - Libraries.io.html - www.Torben Könke (smiley22) - Libraries.io.html )

 /// <summary>
		/// Deletes the mail message with the specified UID.
		/// </summary>
		/// <param name="uid">The UID of the mail message to delete.</param>
		/// <param name="mailbox">The mailbox the message will be deleted from. If this parameter is
		/// omitted, the value of the DefaultMailbox property is used to determine the mailbox to
		/// operate on.</param>
		/// <exception cref="BadServerResponseException">The mail message could not be deleted. The
		/// message property of the exception contains the error message returned by the
		/// server.</exception>
		/// <exception cref="ObjectDisposedException">The ImapClient object has been disposed.</exception>
		/// <exception cref="IOException">There was a failure writing to or reading from the
		/// network.</exception>
		/// <exception cref="NotAuthenticatedException">The method was called in non-authenticated
		/// state, i.e. before logging in.</exception>
		/// <seealso cref="MoveMessage"/>
		public void DeleteMessage(uint uid, string mailbox = null) {
			DeleteMessages(new HashSet<uint>() { uid }, mailbox);
		}

		/// <summary>
		/// Deletes the mail messages with the specified UIDs.
		/// </summary>
		/// <param name="uids">An enumerable collection of UIDs of the mail messages to delete.</param>
		/// <param name="mailbox">The mailbox the messages will be deleted from. If this parameter is
		/// omitted, the value of the DefaultMailbox property is used to determine the mailbox to
		/// operate on.</param>
		/// <remarks>When deleting many messages, this method is more efficient than calling
		/// <see cref="DeleteMessage"/> for each individual message.</remarks>
		/// <exception cref="ArgumentNullException">The uids parameter is null.</exception>
		/// <exception cref="ArgumentException">The specified collection of UIDs is empty.</exception>
		/// <exception cref="BadServerResponseException">The mail messages could not be deleted. The
		/// message property of the exception contains the error message returned by the
		/// server.</exception>
		/// <exception cref="ObjectDisposedException">The ImapClient object has been disposed.</exception>
		/// <exception cref="IOException">There was a failure writing to or reading from the
		/// network.</exception>
		/// <exception cref="NotAuthenticatedException">The method was called in non-authenticated
		/// state, i.e. before logging in.</exception>
		/// <seealso cref="MoveMessages"/>
		public void DeleteMessages(IEnumerable<uint> uids, string mailbox = null) {
			AssertValid();
			uids.ThrowIfNull("uids");
			string set = Util.BuildSequenceSet(uids);
			lock (sequenceLock) {
				PauseIdling();
				SelectMailbox(mailbox);
				string tag = GetTag();
				string response = SendCommandGetResponse(tag + "UID STORE " + set +
					@" +FLAGS.SILENT (\Deleted \Seen)");
				while (response.StartsWith("*"))
					response = GetResponse();
				ResumeIdling();
				if (!IsResponseOK(response, tag))
					throw new BadServerResponseException(response);
			}
		}

wielkie dzięki za podpowiedź głównie jaką wartość miałbym podać w metodzie DeleteMessage() aby skutecznie usunięta została wiadomość np. numer 3
Remiq

0

oczywiście wpisywałeś w google "IMAP how to delete message c#"?

0

dzięki właśnie znalazłem jeszcze jedną interesującą bibliotekę Koolwired.IMAP z opisem problemu mnie interesującym w odniesieniu do tej biblioteki...

i może nawet przeskoczę na jej użycie, jednakże problem wydaje mi się jest szerszy czyli już dotyczący obu tych bibliotek

a smile22 przechwalał był się, jakoby Jego biblioteka jest dość dobrze opisana...

a my zadajemy potem jakieś głupkowate zapytania i tego nie mogę pojąć jak Ktoś dołączył testy jednostkowe w projekcie
a nie opisał lub nawet w projekcie NIE ZAWARŁ przykładowych metod lub nie opisał jakie wartości przykładowe należy podawać w argumentach-parametrach

i to jak widzę dotyczy nie tylko tego projektu ale też miałem problemy z Active Directory do Azure, OAuth2...
i nie rozumiem jak można nie dopełniić tego obowiązku aby mój projekt służyć mógł możliwie największej liczbie użytkowników...

raz jeszcze dzięki Ci za wskazówkę ROnq

1 użytkowników online, w tym zalogowanych: 0, gości: 1