Yearly recurring appointment
hey guys. have powershell script has $date variable has birthday of someone. example "01/08/91".
now want pretty simple. create new appointment runs once year @ birthday starting year of birth , lasting forever. example 01/08/91, 01/08/92, ... , , on.
i tried writing script creates new appointment runs every day , not once year.
please me, appreciated!
- gal.
hhhmmm...so using outlook. in case script should this:
get-content c:\birthday.txt | foreach-object { $username = $_.substring(0,8) $birthday = $_.substring(9,10) $fullname = $_.substring(20) $firstname = $_.substring(0,$fullname.indexof(" ")) $lastname = $_.substring($fullname.indexof(" ")+1) # far script works fine getting every user information. want make recurring event once year start @ $birthday # creating new appointment $outlook = new-object -comobject outlook.application $session = $outlook.session $session.logon() $appt = $outlook.createitem("olappointmentitem") # filling in appointment fields $appt.meetingstatus = 1 $appt.start = [datetime]::parseexact($birthday,"dd/mm/yyyy",$null) # converting $birthday string datetime format (i found on internet) $appt.alldayevent = 1 # making event day event since it's birthday $appt.requiredattendees = email@domain.com # want appointment sent username $appt.subject = "happy birthday" + $firstname + $lastname $appt.location = "world" $appt.body = "congratulation" # setup recurrence $recurr = $appt.getrecurrencepattern() $recurr.recurrencetype = 5 $recurr.starttime = "02/19/2012 15:00" $recurr.endtime = "02/19/2012 15:00" $recurr.patternstartdate = get-date # part want make appointment recurring once year , don't know how.. # send mail $appt.send() }
refer link know other recurrence type:
hope helps...!!!
please click “mark answer” if post answers question , click "vote helpful" if post helps you.
Windows Server > Windows PowerShell
Comments
Post a Comment