powershell exchange 2010 grab body of email and set to variable - windows

i am trying to get the body of an email and set it to a variable with powershell by using get-mailbox. the reason im not doing it an easier was is it is blocked on the network to get the body from outlook. im completly lost. ive tried export but thats to pst. ive tried doing a search query with logging but thats a bust also. im pretty lost anything to point me in the direction would be great.

As far as I know, Get-Mailbox won't do that, unfortunately. It'll get you information about the mailbox, but not it's contents. If you want to work w/ the contents of a mailbox, and you can't use Outlook, your best bet is probably the Exchange Web Service (EWS).

There is a way to do this but it really depends on how much you are willing to work to make it possible.
The best way that I could think of is using the EWS API. It's messy and it takes a while to learn so you will probably need to put some time and effort into making the script (unless you can find someone else who has).
Basically I got all of these links by doing a google search for "Powershell EWS API"
Here is another similar question:
How to check an exchange mailbox via powershell?
Here is some more help with how to use the API (it's kinda tricky):
http://blogs.technet.com/b/heyscriptingguy/archive/2011/12/02/learn-to-use-the-exchange-web-services-with-powershell.aspx
http://www.xipher.dk/WordPress/?p=739
Here are some examples to work off of (the first one is closest to what you are looking for):
http://social.technet.microsoft.com/Forums/scriptcenter/en-US/335a888b-bf85-4a36-a555-71cc84608960/download-email-content-text-from-exchange-ews-with-powershell?forum=ITCG
http://social.technet.microsoft.com/Forums/exchange/en-US/0ad086bd-eb23-4ece-a362-696fa526a7e6/retrieve-messages-from-inbox-subfolder?forum=exchangesvrdevelopment
http://poshcode.org/2978
Hope that helps!

Related

Service worker, caching a graph query request

so I'm getting in the world of service workers, found it complex for my level, and despite I manage to cache my physical files in my vue 3 project. I'm struggling with the way of caching the response from headless CMS, there is a lot information around about in general most of then very old, at the beginning I tried using workbox, then I read that you cannot catch graph response or post response(correct if I am wrong), in addition I was having a lot of issues trying to include the script with the vue 3 project and some error about some array, so ended up building the sw from scratch and it worker pretty well so far. Now I'm facing the issue with the graph response, so far I have read it's not easy which is quite discouraging when u read it from more experienced people. I have found some examples and lot of user asking the same question here some with no response as well, and so far I found an interesting response(3 years old), however I am not sure if this actually applies for my case if is deprecate. He provides a code example, however is not providing information about what exactly does the script, you can see the response here
So I am assuming the URL that needs to be provide is the url to my graph API in this case the one provide for CMS. And the in the variable cachedResponse under the catch, do I need to provide the query variable, meaning the const that I am using to call the graph? I have to mention I am not using apollo nor axios just a normal graph inclusion.
Also when I tried to run this code, at the beginning I got an issue with the script from dexie.js and had mime issue which I tried to correct with some suggestion from here. Which did not work for me. I thought that was my sw cache playing bad, however I cleaned it got same issue.
So so far have been a long way, It seems there is not magic formula, but if I can receive an advice or different approach from what I have been trying so far, would be very welcome. Thank you in advance for the help : )

Telegram Group Filtering

I've been using an open source version of Telegram called Bettergram, which claims to be the same protocols. Whether that is true or not to the side, I realized that even though Telegram does not allow pornography, there's a crap ton of it floating around. Is it possible to build a small edit into the code of bettergram (being that it is open-source) to have it block or not register chats or groups that have certain keywords within them(explicit results within group would trigger to be blocked).If this is possible, how hard is it (and can someone help me.) Thanks guys! :) link: https://github.com/bettergram/bettergram

how to send a request to google home\assistant like IFTTT+webhooks

Please direct me the right way. I'm stuck with some documentation issue. Going to code a small service with Google HOME for everyone to add a new phrase and make a POST request or answer with specific "TEXT" (like IFTTT run with WEBHOOKS) (fe: "Hey Google switch my kitchen light" -> service will send POST request to my own HTTP server). I know that IFTTT works but - I would to code the target service for tiny cases with fast response.
I tried to understand all Google Assistant layers - but still no luck and didn't find the clear path.
What I learned are:
1. connect to Google Account using OAuth 2
2. .... save the phrase and action for that in my DB - it's ok and simple way
3. ...??? how to send and to where? in (json?) a specific format
4. receive the answer from google home to understand the right case and make my action.... (for example: turn on\off the kitchen light)
It should be not so hard as I can image.... anyway Please help :).
Appreciate your time and answers and have a nice day!
To learn about extending the Google Assistant, you should look into the documentation for Actions on Google: https://developers.google.com/actions/extending-the-assistant
Although it also seems like you want to use it for Smart Home: https://developers.google.com/actions/smarthome/
You can run the Smart Home sample if you want to see how it works: https://github.com/actions-on-google/actionssdk-smart-home-nodejs

Creating a view-field with the sender's domain

It's cleanup time.
I'd like to cleanaup my mails. Therefore it would be nice to have all emails sorted/grouped by domains (optionally by TLD's as well).
I'm already using something similar - the field for the sender's email adress, which was described at https://www.howto-outlook.com/howto/viewsenderaddress.htm, which works perfectly. So I think something similar can be done for the domain (and TLD) as well.
Has someone here either a working solution ans share it or guide me how to achieve this.
Thx.
Remarks:
It's Outlook 2007 without Exchange
Thanks to a big search engine when using the proper words solution can be found. :-)
I have found a solution which displays the Senders Domain: https://www.extendoffice.com/documents/outlook/2190-outlook-view-sender-domain.html
and to Sort and Group on the Domain use
https://www.extendoffice.com/documents/outlook/2187-outlook-sort-group-by-sender-domain.html

Chasing referrals like ldp.exe in the win32 ldap API

I've been using ldp.exe to guide development of some ldap code for Active Directory. I'm using the win32 API (wldap32). ldp.exe has been extremely helpful in this regard, because in the right pane of the program it shows (more or less) the actual win32 API functions and arguments used to carry out the commands. I find this particularly helpful when crafting calls for ldap_search. If I can get the search to work in ldp.exe, I can directly translate the search to ldap_search.
This was all working as expected until I tried to query a trusted, linked base domain. For example, I login and authenticate to x.net. But I am trying to query the domain y.net which is trusted from x.net.
A search query like (SAMAccountName=mylogin) with BaseDN DC=x,DC=net works in ldp.exe immediately. If I change the BaseDN to DC=y,DC=net it will not work. However, if go to Search Options in ldp.exe and check the box for 'Chase Referrals', the query will work.
Here is the problem. I don't know what checking that box does in terms of win32 API calls. When I query BaseDN DC=y,DC=net with ldap_search directly the return code is LDAP_REFERRAL.
At first, I thought fixing it would be as simple as calling ldap_set_option with LDAP_OPT_REFERRALS, but that doesn't seem to be enough. I've tried settings various other referral related flags like LDAP_OPT_REFERRAL_HOP_LIMIT to larger numbers hoping that is my problem, but nothing seems to work.
I suppose that one possibility is that ldp.exe is actually following those referrals manually with additional function calls (but not actually showing it on the GUI). However, I have not found any good examples of how to do that. If anyone has an example of that, it would be greatly appreciated.
Additionally, I know this query can work because I have access to C# code using DirectoryEntry and DirectorySearcher that works fine in this case.
Does anyone know what is going on in ldp.exe 'Chase Referrals' and how to translate it to the win32 API?
If you see ldp.exe console output, win32 api ldap_search also get's LDAP_REFERRAL. However ldp.exe does follow referrals with additional functions which we don't see in the console as those are not api's.

Resources