How to handle Reminder that are old and new for windows phone - windows-phone-7

say, this is the way to create reminder:
Reminder reminder = new Reminder(name);
reminder.Title = titleTextBox.Text;
reminder.Content = contentTextBox.Text;
reminder.BeginTime = beginTime;
reminder.ExpirationTime = expirationTime;
reminder.RecurrenceType = recurrence;
reminder.NavigationUri = navigationUri;
// Register the reminder with the system.
ScheduledActionService.Add(reminder);
I can not see the result as I use emulator and I have these questions:
1) If I create a reminder today 25/Jul : Begin time 25-jul and ExpirationTime : 25-jul, after 25-jul, will the reminder created on 25-jul will still be in the system or scheduler?
2) If the expirationTime is 28-Jul, will it shows the BeginTime when this reminder got activated on 28-jul?
3) How to I retrieve all the reminders have not be activated.
Thanks
--- Updated :
var reminders = ScheduledActionService.GetActions (ScheduledAction)();
.Where(a => a.IsScheduled);

1) Yes, it will be there. Reminders associated with an application are still available, even if those are dismissed by the user.
2) The BeginTime will be set according to the class property that is set by the application, not when the reminder was activated.
3) You can retrieve all reminders registered for your application through:
var n = ScheduledActionService.GetActions<Reminder>();
foreach (Reminder r in n)
// Action here
You can check the IsScheduled property to make sure that the reminder is scheduled to be triggered or is already out of the queue.

Related

c# Create Windows Scheduled task for Any logged on user

c# Create Windows Scheduled task for Any logged on user (Built-In\Users) or "S-1-5-32-545"
I have a manually created scheduled task that works well. I would like to replicate the scheduled task when my solution is installed. It must run for any user that logs in and not run at a SYSTEM level. I have tried multiple versions of the items below with no luck.
// Create a new task definition and assign properties
TaskDefinition taskDefinition = taskService.NewTask();
taskDefinition.Settings.MultipleInstances = TaskInstancesPolicy.IgnoreNew;
taskDefinition.RegistrationInfo.Description = "Ensures the Agent is running";
taskDefinition.RegistrationInfo.Documentation = "Documentation at website";
taskDefinition.Principal.UserId = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
//taskDefinition.Principal.GroupId = "S-1-5-32-545";
//taskDefinition.Principal.RunLevel = TaskRunLevel.Highest;
//taskDefinition.Principal.GroupId = "Users";
//taskDefinition.Principal.LogonType = TaskLogonType.InteractiveToken;
[1]: [Scheduled Task]https://i.stack.imgur.com/uuGmn.png

How do I add an iCal event using JS automation in OS X Yosemite?

I'm really having a hard time understanding how to interact with iCal using the new support for Javascript automation in Yosemite. I'm not too experienced with OOP so that might be where my problem lies.
Could someone help me out with the code for adding a new event to a specified calendar? I can probably reverse engineer it from there to understand how to work with it.
Thanks
UPDATE
Here is the code I am trying..
// -- perform adding to iCal
// -- select "Test" calendar
theCalendar = iCal.calendars.Test;
events = theCalendar.events;
// -- load in the events
stringifiedData = Safari.doJavaScript("localStorage.getItem('theEvents');", {
in: Safari.windows[0].tabs[0]})
// -- parse data back to js object
theEvents = JSON.parse(stringifiedData);
// -- loop through events
for (var key in theEvents) {
var obj = theEvents[key];
// -- set vars
theDate = obj['date'];
theDescription = obj['description'];
theSummary = obj['summary'];
theLocation = obj['location'];
theStartTime = theDate + " " + obj['startTime'];
theEndTime = theDate + " " + obj['endTime'];
// -- create event object
theEvent = iCal.Event({
description: theDescription,
summary: theSummary,
location: theLocation,
startDate: theStartTime,
endDate: theEndTime
});
// -- get the last index event
last = events.length;
// -- insert it into iCal
events.push(theEvent);
}
The error i'm receiving..
Error on line 68: TypeError: undefined is not an object (evaluating 'events.push(theEvent)')
UPDATE
I figured out the issue. I was formatting the dates incorrectly.. they were just strings. So I made sure to turn them into date objects, and I was able to insert successfully using
events[last] = theEvent;

EWS. How to change DateTimeCreate property via EWS Proxy Classes

I write client application that uses Exchange Web Services Proxy Classes in order to connect to Exchange Web Services. Sometimes, I need create ItemType object and make it looks like as received letter. Therefore I need set up such properties of ItemType as DateTimeSent, DateTimeCreate, DateTimeReceived, but they haven’t public set assessTherefore I need set up such properties of ItemType as DateTimeSent, DateTimeCreate, DateTimeReceived, but they haven’t public set assessor.
I found resolve for some of them via MAPI properties:
ItemType newItem = xmlParser.LoadItem(); //info for newItem takes from xml
newItem.ExtendedProperty = new ExtendedPropertyType[1];
PathToExtendedFieldType q = new PathToExtendedFieldType();
q.PropertyTag = "3590"; //DeliveryTime
q.PropertyType = MapiPropertyTypeType.SystemTime;
newItem.ExtendedProperty[0] = new ExtendedPropertyType();
newItem.ExtendedProperty[0].ExtendedFieldURI = q;
newItem.ExtendedProperty[0].Item = new System.DateTime(2014, 5, 5, 5, 5, 5).ToString("yyyy-MM-ddTHH:mm:ssZ");
Well, it works for DateTimeSent and DateTimeReceived, but not for DateTimeCreate. ES dont give any errors, but DateTimeCreate doesnt change. I tried to UpdateItem with DateTimeCreate propery, but there was no result (update another properties runs fine).
P.S. MAPI ID for CreationTime: 0x3007.
Can someone help me with this problem?
I finally found a solution for this.
Source: https://social.msdn.microsoft.com/Forums/en-US/40a29c69-96d3-488b-8f0e-911dd5f04086/setting-a-emailmessage-datetimesent-and-isdraft?forum=exchangesvrdevelopment
You have to set 3 Extended MAPI properties PR_MESSAGE_FLAGS, PR_MESSAGE_DELIVERY_TIME, and PR_CLIENT_SUBMIT_TIME. Make sure when setting the Time you use UTC time.
For example:
EmailMessage emUploadEmail = new EmailMessage(service);
emUploadEmail.MimeContent = new MimeContent("us-ascii", bdBinaryData1);
// PR_CLIENT_SUBMIT_TIME
emUploadEmail.SetExtendedProperty(new ExtendedPropertyDefinition(57,MapiPropertyType.SystemTime), DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"));
// PR_MESSAGE_DELIVERY_TIME
emUploadEmail.SetExtendedProperty(new ExtendedPropertyDefinition(3590, MapiPropertyType.SystemTime), DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"));
// PR_MESSAGE_FLAGS
emUploadEmail.SetExtendedProperty(new ExtendedPropertyDefinition(3591,MapiPropertyType.Integer),"1");
emUploadEmail.Save(WellKnownFolderName.Inbox);
Create and last modified dates are read-only and cannot be set. The store provider updates these properties internally.

Get EntryID of new mail

We made a script that automatically opens the Microsoft Outlook new mail window. Some things have to be filled in already. This works so far:
Set Arguments = WScript.Arguments
If Arguments.Count > 4 Then
Set Outlook = CreateObject("Outlook.Application")
Set BodyObject = CreateObject("Scripting.FileSystemObject")
Set Mail = Outlook.CreateItem(0)
Mail.To = Arguments(0)
Mail.CC = Arguments(1)
Mail.BCC = Arguments(2)
Mail.Subject = Arguments(3)
Set BodyFile = BodyObject.OpenTextFile(Arguments(4))
Mail.Body = BodyFile.ReadAll
BodyFile.Close
For Counter = 5 to (Arguments.Count - 1)
Mail.Attachments.Add Arguments(Counter)
Next
Mail.Display
End If
But know we want to know if that mail gets sent by the user and we also want to know the EntryID of that mail, so we can look it up later.
Now Mail.Display doesn't return anything and the program just ends. It does not wait until the window gets closed. So after Mail.Display, there should be something like: Mail.Wait, or a Mail send event so we can get the EntryID.
Could someone help us out?
Thanks in advance,
Gillis and Emiel
I just found a probable solution from here:
You need to wait and get the EntryID
value after the item has been
delivered from the Outbox. To do this,
subscribe to the Folder.Items.ItemAdd
event on the Sent Items folder. That
event passes the newly added -- i.e.
newly sent -- item as its argument.
The item must exist first in Outlook to have an EntryID value, use the Save Property and fetch its EntryID right after
Mail.Save
strEntryID = Mail.EntryID
I've got a sample written in VBA for saving notes from Access form to Outlook
Dim outobj As Outlook.Application
Dim outappt As Outlook.NoteItem
Set outobj = CreateObject("outlook.application")
Set outappt = outobj.CreateItem(olNoteItem)
With outappt
If Not IsNull(Me!strBody) Then .Body = Me!strBody
.Save
Me!strEID = .EntryID
End With

Using ExchangeService to Add Appointment Occurances

The target is someone's Exchange Calendar (2007). I want to add a simple "Appointment Occurance" to someone's calendar. This code works (I am using the Microsoft.Exchange.WebServices.dll):
service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.Credentials = new NetworkCredential("supervisor", "password", "DOMAIN.COM");
service.AutodiscoverUrl("<employee#domain.com>", ValidateRedirectionUrlCallback);
appt = new Appointment(service);
appt.Subject = "<subject>";
appt.Body = "<Body Text>";
appt.Start = _DateFrom;
appt.End = _DateTo;
appt.Sensitivity = Sensitivity.Private;
appt.Save(WellKnownFolderName.Calendar);
However, there are problems with this code:
The appointment target is the employee. When adding the appointment, the appointment shows up for the employee (yay!) but also for the supervisor (boo!). Am I supposed to use the employee's credentials? If so, what if I do not have access to that - only the supervisors, am I out of the game already?
The appointment shows up in Outlook as a "Meeting Appointment" and not and "Appointment Occurrence". So, the box to input meeting attendees is showing (with no one in it of course), and is irrelevant in my scenario.
appt.Body does not respond at all to Environment.NewLine or "\r\n" - I haven't tried HTML yet.
Instead of WellKnownFolderName.Calendar
You should use new FolderId(WellKnownFolderName.Calendar,"employee#domain.com")
So the last line becomes
appt.Save(new FolderId(WellKnownFolderName.Calendar,"employee#domain.com"));
Also having problems with the newline, this is only since version 1.1 so it probebly is a bug

Resources