How to set RDOMail.Sender property? - outlook-2007

I am updating an Email using Redemption to set the value of Sender of the Email, so I use this code:
RDOMail rdoMail = Globals.ThisAddIn.session.GetMessageFromID(mail.EntryID);
rdoMail.Sender = //What goes here?
But, I have no idea how to create the RDOAddressEntry to set the Sender property of the Email, any ideas?

You need to set it to an instance of the RDOAddressEntry object.
RDOAddressEntry object can be retrieved from another RDOMail object (RDOMail.Sender), RDOSession.AddressBook.ResolveName, or one of the address lists (RDOSession.AddressBook.AddressLists).
You might also want to set the RDOMail.SentOnBehalfOf property (it too needs an instance of the RDOAddressEntry object).

Related

How to add a request wise variable in httpcontext

In HttpContext(Or some thing like this) I need to add a temperory variable from a controller which need to available through out the request processing(Request wise variable). But the HttpContext.Current.Request is readonly. If i'm adding in Items its not getting outside. How can i achieve this
Thanks & Regards
Binesh Nambiar C
You are looking for HttpContext.Items, which is a dictionary that can be used to store items for the duration of the current request. It goes out of scope at the end of the request.
// Set
HttpContext.Items["Customer"] = customer;
// Get
var customer = HttpContext.Items["Customer"];

Access Parse Object ID right after instantiation

I'm creating two PFObjects at the same time that should reference each other's object IDs when they're saved. In the example below, the second object is supposed to save the first object's object ID in an array.
let objectForFirstClass = PFObject(className:"ClassOne")
let objectForSecondClass = PFObject(className: "ClassTwo")
objectForSecondClass.setObject([objectForFirstClass.objectId!], forKey: "classOneObjectArray")
The last line is causing the error because objectForFirstClass.objectId is nil. I'd assume this is because the object hasn't been saved yet. How can I fix this?
You want to save after creating the first object, and in the completion handler, create the second one with a reference to the first one.
You can use saveAllInBackground:block: for this.
Correct, the object id is assigned by the server when saved. I'd be tempted to write some cloud code to do what you want so you can send some details and the cloud code will create and connect the objects, then return both of them to you. You can of course do the same thing locally in your app, there's just more network comms.
You should also consider using pointers or relationships. These are better for querying, though the same save requirements apply before you can set the connections.

Keep a session variable value after it has been cleared?

Question background:
I have a session object that is used to store a list of object called 'CartItems'. I convert this object to an actual instance, set it to another List variable then finally clear the list. This is then sent to to a ViewBag variable and sent to a View.
The issue:
What I'm trying to do may not be possible but currently as soon as I clear the list instance of CartItems all references to this are lost aswell. Please see the following code:
public ActionResult Complete(string OrderId)
{
//Retrieve the CartItem List from the Session object.
List<CartItem> cartItems = (List<CartItem>)Session["Cart"];
//Set the list value to another instance.
List<CartItems>copyOfCartItems= cartItems;
//Set the ViewBag properties.
ViewBag.OrderId = OrderId;
ViewBag.CartItems = copyOfCartItems;
//Clear the List of CartItems. This is where the **issue** is occurring.
//Once this is cleared all objects that have properties set from
//this list are removed. This means the ViewBag.CartItems property
//is null.
cartItems.Clear();
return View(ViewBag);
}
Can I store this value without losing it after clearing the List?
When you do
ListcopyOfCartItems= cartItems;
You are creating a another variable by the name of copyOfCartItems that points to the same object cartItems. In other words cartItems and copyOfCartItems are now two names for the same object.
So when you do cartItems.clear(); you are clearing all the list items on the base object.
To get around this, make a copy of cartItems, rather than creating a reference
List<CartItems> copyOfCartItems = new List<CartItems>();
cartItems.ForEach(copyOfCartItems.Add); //copy from cartItems
If you want to clear Session["Cart"], use Session.Remove("Cart")

Is it possible to assign a new value to a returned pointer?

I have a form that I'm creating and to simplify things, I'm trying to create a form field mapper to an object. As such, I create the following dictionary:
self.fieldPropertyMapper = #{
#(CompanyFieldName):self.company,
#(CompanyFieldDescription):self.company.description,
#(CompanyFieldWebsite):self.company.website,
#(CompanyFieldTwitter):self.company.twitter,
#(CompanyFieldAddress):self.company.address,
#(CompanyFieldAddress2):self.company.address2,
#(CompanyFieldCity):self.company.city,
#(CompanyFieldState):self.company.state,
#(CompanyFieldZipcode):self.company.zipcode,
#(CompanyFieldPhone):self.company.phone
};
The keys here are members of the CompanyFieldType enum.
My goal here is to later in my form to assign a value to the returned pointer. Here's what I mean: when a text field in one of my forms stops editing, I'm looking to set the value. Here's what I'd like to accomplish:
- (void)textFieldDidEndEditing:(UITextField *)textField
{
CompanyFieldType fieldType = [self fieldTypeForTag:textField.tag];
// Set the value of the respective company property
// In theory it would be something like:
// self.fieldPropertyMapper[#(fieldType)] = textField.text;
}
I'm assuming there's a way to assign by reference but I'm forgetting how to do this. (Is it using the & symbol or **?) I don't remember. Help appreciated! If I'm messing up my terminology, feel free to let me know.
You can't do exactly what you want to do. That is to say, there is no pointer magic that will do what you want.
You can get essentially the same effect, though, with key-value coding. Instead of storing the result of accessing the property (e.g. self.company.website), instead you want to just store the key path to the value you're interested in as a string — e.g. #"company.website". Then you can do like so:
[self setValue:textField.text forKey:self.fieldPropertyMapper[textField.tag]];
Using NSMapTable initialized with NSPointerFunctionsStrongMemory for the keys and NSPointerFunctionsOpaqueMemory for the values. Then you could store the addresses of your iVars backing your properties as the values in the table.
[self.mapTable setObject:&_company forKey:#(CompanyFieldName)];
Haven't tested this but this should get you started.

Using rails send an email when column value chnge from nil to non-nil value

I want to send an email to user when its value changing from nil to non nil value.
following conditions should get satisfied
Value is non-nil while creating An email should be sent to user, no mail should be sent to user after updating table.
Value is nil while creating.After update it should check that value is non-nil
and if value is change from nil to no-nil an email should get send to the user
I want generalised method to do so as i have created object from several places and it's not possible for me to put code everywhere to send an email
Sounds like the perfect job for an observer.

Resources