abraham
abraham

Reputation: 63

How Can i Read a unread SMS on uwp?

I need some help. I have this code:

Windows.ApplicationModel.Chat.ChatMessageStore store = await Windows.ApplicationModel.Chat.ChatMessageManager.RequestStoreAsync();
var msgList = store.GetMessageReader();
IReadOnlyList<Windows.ApplicationModel.Chat.ChatMessage> a = await msgList.ReadBatchAsync()

And I read all SMS with this

foreach (var item in a)
{
    System.Diagnostics.Debug.WriteLine(item.Body);
}

How can I read only unread SMS? I mean only read new SMS and afterwards change the status to 'read'.

Question is for Uwp Win 10..

Upvotes: 1

Views: 432

Answers (1)

Alexej Sommer
Alexej Sommer

Reputation: 2679

Take a look at ChatMessage class

IsRead property is Read-only. That mean you can only check is message already readed. But you can't set that message is been readed or unreaded

       foreach (Windows.ApplicationModel.Chat.ChatMessage item in a)
        {
            if (item.IsRead) System.Diagnostics.Debug.WriteLine(item.Body);
        }

Upvotes: 2

Related Questions