title: update categories in emails using python
body: <p>I am trying to update categories of emails available in one of the data frame using below code.</p>
  
  <pre><code>outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
  inbox = outlook.GetDefaultFolder(6)
  messages = inbox.Items
  
  i = 0
  
  for message in messages:
         try: 
          message.Categories = output.iat[i,2]
         except:
             message.Categories = 'No Category'
         i = i + 1  
  </code></pre>
  
  <p>Below script used to move updated emails from inbox to another folder and then remove to inbox</p>
  
  <pre><code>donebox = outlook.GetDefaultFolder(6).Folders[20]
  
  def delay(time):
      for j in range(time):
          j=j+1
  
  
  i = 0
  
  while (messages.Count &gt; 0):
      print(i,messages.Count)
      message = messages.GetLast()
      message.Move(donebox)
      delay(1000000)
      i = i + 1
  
  
  messages = donebox.Items
  
  i = 0
  
  while (messages.Count &gt; 0):
      print(i,messages.Count)
      message = messages.GetLast()
      message.Move(inbox)
      delay(1000000)
      i = i + 1
  </code></pre>
  
  <p>In outlook updated Categories from output dataframe for emails are able visible only once email selected. Is there any option which can refresh outlook and categories will be updated automatically. Please advice.  </p>