Having trouble getting a powershell script to execute RRS feed

  • Question

  • I am not a .NET developer, so, this is unfamiliar territory-

    I got a ps1 script that is meant to pull calendar events from your office 365 outlook calendar. From what I can tell it authenticates your powershell session to connect to outlook... and the auth is popping up, but then it just stops dead. I have no idea how to debug this.

    It's on github, user is lazywinadmin, repo is O365-Get-O365CalendarEvent (I can't paste links here yet)

    The readme on github includes the command you would run, but other than that, essentially no instructions on how to use it.

    I have changed the windows permissions to allow scripts to run, but I what would normally work for a ruby or python or other script is not getting me there.

    Is there some other thing I need in order to make this work? Or, perhaps, has the office API moved on and this code is deprecated?

    Thank you in advance for any assistance.

    Friday, February 14, 2020 10:55 PM

All replies

  • It kind of hard to help you if you can't provide an error message, the code that is failing or instructions on how to get the code.

    Friday, February 14, 2020 11:48 PM
  • Sorry but this is not a GitHub forum.  You will need to post issues with GitHub component t6o the author on GitHub.

    I also suggest that you read the help for the CmdLet.  To learn how to us PowerShell you will have to find a book or a tutorial.

    This forum does not support scripts that non-Windows people have found on teh Internet,


    You also need to take some time to learn how to ask a technical question. 

    I did look at the code.  It is quite amateurish but its use is quite well described,  Did you even read what was posted?

    Most of your issue is because you have no experience or training in PowerShell.  The other thinking you are missing is any training in O365 and its API.  The code delivered is mostly unnecessary other than it provides the URI needed and a method for creating it.

    The code posted has detailed instructions and many examples.  Please take the time to learn how to use all of these things like GitHub, )365 Rest API and PowerShell.  Once you have enough of the basics and you still have issues then post back with your script and a clear question about the issue.

    I can also note that the code is very old.  O365 API has been changed many time since.  I suggest that once you learn O365 you will not want to us the script.  I also suggest that you may also have issues with MFA which will require you to take the time to set up O365 for API access.

    I can also note that there are some serious design deficiencies in the code.  Under many normal sets of parameters the code will fail.  Even when it works it can take a very long time to execute.

    Without you understanding PowerShell or how programmed systems work it is not possible to know how to advise you further.  The examples in the help are explicit.  When you learn basic PowerShell they will make sense.  If you have issues with you tenancy then you will need to contact O365 support for help.  

    Also the script was written to teh Outlook Rest QAPi 1.0.  We are now using the 2.0 version and the 1.0 version will not likely work with current mail searches.

    Here are the docs for the current 2.0 API: https://docs.microsoft.com/en-us/previous-versions/office/office-365-api/api/version-2.0/mail-rest-operations


    Saturday, February 15, 2020 12:05 AM
  • /facepalm/ I forgot the error, sorry- so, I have removed my email from the strings, but, here are the two ways I have tried running this- one gets an error, the other just stops after creds with no error message. And as I mentioned, it is popping the windows credentials dialogue, and after I enter my creds, nothing happens:

    PS C:\Users\user1\Desktop> Get-O365CalendarEvent -EmailAddress validaddress@outlook.com -Credential (Get-Credential) -Start
    DateTime ((Get-Date).adddays(-5)) -EndDateTime (Get-Date) -PageResult 2 Select-Object -Property Subject, StartTimeZone,
    Start, End

    cmdlet Get-Credential at command pipeline position 1
    Supply values for the following parameters:
    Get-O365CalendarEvent : The term 'Get-O365CalendarEvent' is not recognized as the name of a cmdlet, function, script
    file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
    and try again.
    At line:1 char:1
    + Get-O365CalendarEvent -EmailAddress validaddress@outlook.com -Credential ...
    + ~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (Get-O365CalendarEvent:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException

    PS C:\Users\user1\Desktop> .\O365-Get-O365CalendarEvent.ps1 Get-O365CalendarEvent -EmailAddress validaddress@outlook.com -C
    redential (Get-Credential) -StartDateTime ((Get-Date).adddays(-5)) -EndDateTime (Get-Date) -PageResult 2 Select-Object -
    Property Subject, StartTimeZone, Start, End

    cmdlet Get-Credential at command pipeline position 1
    Supply values for the following parameters:
    PS C:\Users\user1\Desktop>

    Tuesday, February 18, 2020 7:21 PM
  • This may help you figure out what you are doing wrong:



    Tuesday, February 18, 2020 7:41 PM