The GetNamespace(“MAPI”) command leads to the error message:
Ausnahme beim Aufrufen von “GetNamespace” mit 1 Argument(en): “Das COM-Objekt des Typs “Microsoft.Office.Interop.Outlook.ApplicationClass” kann nicht in den Schnittstellentyp
“Microsoft.Office.Interop.Outlook._Application” umgewandelt werden. Dieser Vorgang konnte nicht durchgeführt werden, da der QueryInterface-Aufruf an die COM-Komponente für die Schnittstelle
mit der IID “{00063001-0000-0000-C000-000000000046}” aufgrund des folgenden Fehlers nicht durchgeführt werden konnte: Element nicht gefunden. (Ausnahme von HRESULT: 0x8002802B
(TYPE_E_ELEMENTNOTFOUND)).”
In Zeile:2 Zeichen:1
Since this is an English forum error messages in foreign languages are problematic. I’d recommend to ask the question in a German forum or translate the German parts of the error message.
Regardless of that - what do you actually want to do? But I should admit in advance that I don’t have any experiences automating office.
Automating MSFT Office is AFAIK best done with the office internal scripting language VBA. It might be a good idea as well to find a particularily Office related forum.
Sorry, but my assumption was that somebody who has expertise with those COM problems will be able to identify the error message even if it is in mixed German/English. Google translates as
Exception when calling “GetNamespace” with 1 argument(s): “The COM object of type “Microsoft.Office.Interop.Outlook.ApplicationClass” cannot be included in the interface type
“Microsoft.Office.Interop.Outlook._Application” can be converted. This operation could not be performed because the QueryInterface call went to the COM component for the interface
with the IID “{00063001-0000-0000-C000-000000000046}” could not be performed due to the following error: Element not found. (Exception from HRESULT: 0x8002802B
(TYPE_E_ELEMENTNOTFOUND)).”
and this translation appears to match the original English error message quite well.
Exactly that: automating office, in particular Outlook. The problem is that this GetNamespace call is basically the key to all Outlook objects and if that key does not fit, there is no way to work with the other Outlook objects.
Sure, that has been my work around. But I’m simply curious if somebody has a solution for PowerShell.
At keast it’s interesting that you found something which I did not. This alone is a bit strange according to my experience. So it appears that I probably have a very strange mixture of COM objects on my machine that leads to the problem. I’m not really sure if it’s worth a repair or complete re-build of the machine since the work-around with VBA or VBScript works quite well.
I installed the latest version of PowerShell and the problem has disappeared though I use the 64 bit PowerShell with my 32 bit Outlook. Jumping to a conclusion that may be completely wrong, but the problem obviously were not my Outlook COM objects but the way PowerShell worked with those. Confusing stuff …