Exact Target Amp Script Triggered Send There Are No Valid Subscribers - exacttarget

Ampscript post returns no valid users.Any ideas? This is an enterprise account and exact target is not very help full. I created a api call and tried server side js but that returns with even worse response.
%%[
var #emailaddr
SET #emailaddr = 'email#gmail.com'
SET #ts = CreateObject("TriggeredSend")
SET #tsDef = CreateObject("TriggeredSendDefinition")
SET #ts_subkey = 'email#gmail.com'
SetObjectProperty(#tsDef, "CustomerKey", "ET_Support_LS")
SetObjectProperty(#ts, "TriggeredSendDefinition", #tsDef)
SET #ts_sub = CreateObject("Subscriber")
SetObjectProperty(#ts_sub, "EmailAddress", #emailaddr)
SetObjectProperty(#ts_sub, "SubscriberKey", #ts_subkey)
SET #ts_attr = CreateObject("Attribute")
SetObjectProperty(#ts_attr, "Name", "Subscriber Key")
SetObjectProperty(#ts_attr, "Value", #ts_subkey)
AddObjectArrayItem(#ts_sub, "Attributes", #ts_attr)
AddObjectArrayItem(#ts, "Subscribers", #ts_sub)
SET #ts_statusCode = InvokeCreate(#ts, #ts_statusMsg, #errorCode)
]%%

Enterprise accounts in ExactTarget have sub-accounts that are called "On Your Behalf" Accounts. Anytime a subscriber is added to an account or sent an email using TriggeredSend, a value needs to be passed to specify which sub-account they are related to. With a TriggeredSend, this can be accomplished by setting the ChannelMemberID field in the attributes of a subscriber. A list of the sub-accounts can be found in the ExactTarget UI by going to the Admin tab, then 'Enterprise Management' then 'Organizational Chart'.
Code that needs to be added:
SET #attr = CreateObject("Attribute")
SetObjectProperty(#attr, "Name", "ChannelMemberID")
SetObjectProperty(#attr, "Value", "PUT THE NUMERIC VALUE FOR AN OYB ACCOUNT HERE")
AddObjectArrayItem(#ts_sub, "Attributes", #attr)
Full Example:
%%[
var #emailaddr
SET #emailaddr = 'email#gmail.com'
SET #ts = CreateObject("TriggeredSend")
SET #tsDef = CreateObject("TriggeredSendDefinition")
SET #ts_subkey = 'email#gmail.com'
SetObjectProperty(#tsDef, "CustomerKey", "ET_Support_LS")
SetObjectProperty(#ts, "TriggeredSendDefinition", #tsDef)
SET #ts_sub = CreateObject("Subscriber")
SetObjectProperty(#ts_sub, "EmailAddress", #emailaddr)
SetObjectProperty(#ts_sub, "SubscriberKey", #ts_subkey)
SET #attr = CreateObject("Attribute")
SetObjectProperty(#attr, "Name", "ChannelMemberID")
SetObjectProperty(#attr, "Value", "PUT THE NUMERIC VALUE FOR AN OYB ACCOUNT HERE")
AddObjectArrayItem(#ts_sub, "Attributes", #attr)
AddObjectArrayItem(#ts, "Subscribers", #ts_sub)
SET #ts_statusCode = InvokeCreate(#ts, #ts_statusMsg, #errorCode)
]%%
Also, it isn't necessary to pass the Subscriber Key value twice so the following section was removed from the example:
SET #ts_attr = CreateObject("Attribute")
SetObjectProperty(#ts_attr, "Name", "Subscriber Key")
SetObjectProperty(#ts_attr, "Value", #ts_subkey)
AddObjectArrayItem(#ts_sub, "Attributes", #ts_attr)
For ExactTarget specific questions, please check out the Code# Q&A Section at https://code.exacttarget.com/questions/newest

Related

How to get a segment of "member.activity" and how to send custom status' (discord.py)

My whois command is meant to send what the specified user's activity but instead it gives a long reply. I want it to send the activity type and name. Also is there a way for the bot to send a person's custom status
Code:
whois_embed = discord.Embed(timestamp=datetime.datetime.utcnow(), color = 0x00ceea)
whois_embed.add_field(name = "Activity", value = member.activity, inline = False)
await ctx.send(embed = whois_embed)
What the bot sends:
Activity
<Activity type=<ActivityType.watching: 3> name='over 3 servers' url=None details=None application_id=None session_id=None emoji=None>
You'll need to look at the attributes like declared in the docs.
To get the name of the activity use
activityName = member.activity.name
And to get the type use
activityType = member.activity.type
But since member.activity.type is not a string, it will print as something like ActivityType.custom. You could use a dict or something to convert it to a string though.
whois_embed = discord.Embed(timestamp=datetime.datetime.utcnow(), color = 0x00ceea)
whois_embed.add_field(name = "Activity", value = member.activity.name, inline = False)
await ctx.send(embed = whois_embed)

How to programatically create a content item of an existing type in Orchard

I have a Registration content type that I created through the Admin GUI. It only has an id and a common part and some text fields. Can I just do something like:
var registration = services.ContentManager.New("Registration");
registration.Name = "My Name";
registration.Comment = "Some random comment";
services.ContentManager.Create(registration, VersionOptions.Published);
Or will I have to go through the ordeal of completely defining my content type in code and manually taking care of persistence? All of the tutorials that I can find online as well as the official documentation only ever deal with creating content types and items from scratch. There seem to be no examples of simply creating a new item of an existing type.
You can do it like this just fine. If you want to set more settings though, you should cast it do dynamic so you can just rather simply put any value there:
dynamic registration = services.ContentManager.New("Registration");
// It is dynamic, so you can now set any property on it:
// <contentItem>.<theContentPart>.<thePropertyName> = someValue
// <contentItem>.<theContentPart>.<theField>.Value = someValue
// Set properties of a part
registration.ThePartThatHasTheNameProperty.Name = "My Name";
registration.ThePartThatHasTheCommentProperty.Comment = "Some random comment";
// Set properties of a field
registration.ThePartThatHasTheField.TheField.Value = "Some value";
services.ContentManager.Create(registration, VersionOptions.Published);
Or, strongly typed:
var registration = services.ContentManager.New("Registration");
registration.As<SomePart>().SomeProperty = "Some value";
registration.As<SomeOtherPart>().SomeOtherProperty = "Some other value";

How to get send to email id not display name before send email c#

How i get email id not display name like "javalp#gamil.com".
var msg = Item as Outlook.MailItem;
string messageTo = msg.To;
Output: messageTo = "Javal Patel"
Instead of using To/CC/BCC properties, loop through all recipients in the MailItem.Recipients collection and read the Recipient.Address property. You might also want to use the Recipient.Type property (OlMailRecipientType.olTo/OlCC/olBCC) to figure out the recipient type.

Getting "Value does not fall within the expected range" when creating a new discussion with CSOM

I'm using the SharePoint 2013 client object model.
I'm getting a Microsoft.SharePoint.Client.ServerException that says: "Value does not fall within the expected range" when running _context.ExecuteQuery(). The code works as long as I comment out the statement entry["Author"] = authorValue;:
entry["Body"] = post.Body;
entry["Created"] = post.Created;
entry["Modified"] = post.Modified;
FieldUserValue authorValue = new FieldUserValue();
User author = _context.Web.EnsureUser("Mr. X");
_context.Load(author);
_context.ExecuteQuery();
authorValue.LookupId = author.Id;
entry["Author"] = authorValue;
entry.Update();
_context.ExecuteQuery();
"Author" is a valid field name. I also read about increasing "List View Lookup Threshold" to a value of 20 in http://dotnetfollower.com/wordpress/2012/05/sharepoint-value-does-not-fall-within-the-expected-range-exception-in-spfieldmap-getcolumnnumber/. But that value is already set to 5000.
I also checked the value of entry["Author"] without setting it explicitly (entry["Author"] = authorValue commented out) by adding this two statements:
_context.Load(entry);
_context.ExecuteQuery();
It is of type Microsoft.SharePoint.Client.FieldUserValue and it's LookupId property value is equal to authorValue.LookupId.
What did I miss?

How to set Option set value in CRM 2011?

I have an Option set in CRM 2011. It has four options:
Public
Private
Subsidiary
Other
Through plugin I want to set the value of this option set. Can anyone provide me the statement to set the value of this option set?
How to set optionsetvalue in plugins
In plugins you can write yourEntity.yourAttribute = new OptionSetValue(INDEX);
The INDEX is an int you can look up in your optionset editor (default values are several digit long).
OR
You set the optionset like yourEntity.Attributes.Add(“yourAttribute”, new OptionSetValue(INDEX));
You can set an option set value using the following:-
OptionSetValue myOptionSet = new OptionSetValue();
myOptionSet.Value = xxxx
myEntity.Attributes["optionSetAttributeName"] = myOptionSet;
// Where xxxx represents the value desired and can be checked on the attribute metadata page within the entity customisations
Whether 'myEntity' is actually preImage/postImage or just a dynamically created entity in the plug-in will determine whether you need to actually call the update method, but essentially this is the way you set the option set value and update the attribute.
I thought I'd share some code for handling option-sets in CRM here...
fieldValue = ((OptionSetValue)entity.Attributes[field]).Value.ToString();
//need to get Option Set display label based on its value. This requires getting attribute metadata
RetrieveAttributeRequest attributeRequest = new RetrieveAttributeRequest
{
EntityLogicalName = entity.LogicalName,
LogicalName = field,
RetrieveAsIfPublished = true
};
RetrieveAttributeResponse attributeResponse = (RetrieveAttributeResponse)orgContext.Execute(attributeRequest);
EnumAttributeMetadata attributeMetadata = (EnumAttributeMetadata)attributeResponse.AttributeMetadata;
foreach (OptionMetadata om in attributeMetadata.OptionSet.Options)
{
if (om.Value == ((OptionSetValue)entity.Attributes[field]).Value)
{
fieldlabel = om.Label.UserLocalizedLabel.Label;
}
}
return fieldlabel;

Resources