What are the Aweber API Variables $account_id and $list_id? - api

You can check here:
https://labs.aweber.com/docs/code_samples/subs/create
The script to add a new subscriber to the list via api requires those two pieces info...only I cannot figure out for the life of me what those two variables are!! I've beaten through every little aspect of my Aweber Subscriber Account, AND my Aweber Labs account...and I can't find any reference to either of those variables anywhere. I've submitted some tickets to them, and haven't gotten any response yet.
Does anyone have any ideas here? I've tried my account names, my list names, to no avail!
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Okay, I've got it! You can get the values of both of these variables by dumping some other variables in the aweber api after making certain api calls.
get the account id first:
$account = $aweber->getAccount($accessKey, $accessSecret);
then vardump or print_r $account.
next we get the list id:
$account = $aweber->getAccount($accessKey, $accessSecret);
$list_url = 'https://api.aweber.com/1.0/accounts/<id>/lists';
$lists = $account->loadFromUrl($list_url);
then vardump or print_r $lists.
And you are all set! I'm so happy I figured this out, it freakin took long enough. Hopefully this saves some one a bit of time.

I too have agonized over finding the $list_ID, so went to deactivate the list, and create a new one, and "discovered" that if you hover over the Deactivate button, you get a url you can copy, and this gives both %account and %list Ids
https://www.aweber.com/users/lists/deactivate/$accountID/$lisID
like this....
https://www.aweber.com/users/lists/deactivate/123456/123456
Hopefully this will help make someone as it is a super easy solution

The proper answer is Anne Allen's one, but...
Check the return of the /accounts endpoint. It should return the same account id as you detected in the link, but I had cases they were different (strange, isn't it?). Use the account id returned by the /accounts endpoint and other endpoints to retrieve lists, subscribers, etc. will start to work. It's like if some accounts have two ids, one partially works and the other fully works.

Let me tell you how to get $list_id value... login into your AWeber account and then create a new list copy only integer value from list's name.

At first, login.
1) click Reports>Settings. Your account ID will be displayed in the box,example: ?id=XXXXX
2) click List Options>List Settings. There you will see the list ID under the name.
p.s. To add subscriber, you can use this - Automatically add into aweber list

Related

How to clone a UserPrincipal object in VB.NET

I'm trying to create a new User in Active Directory from a VB.NET application. Most fields will be identical to an already existing "template" user, except things like Name, SurName, Email, SamAccountName, etc.
So I want to copy or clone this template User, assign the few fields with a new/different value and then save this new user in Active Directory. I'd like to avoid having to manually assign who-knows how many properties from my template to the new User and maybe forget something along the way..
Is there not a way to do that? I found something about using DirectoryEntry.CopyTo(), but I simply get a "Not implemented" error, and anyway I doubt this is the right direction (Unsure how to use this class together with a UserPrincipal object)
Should I be using a different class than System.DirectoryServices.AccountManagement.UserPrincipal to save my new user in the AD? Do I have the wrong approach?
Any help will be appreciated :)
If you look at the source code for DirectoryEntry.CopyTo, it calls:
newParent.ContainerObject.CopyHere(Path, newName)
And ContainerObject is of the type IADsContainer. If you look at the documentation for IADsContainer.CopyHere, it says (under Remarks):
The providers supplied with ADSI return the E_NOTIMPL error message.
ADSI is "Active Directory Service Interfaces". So the short answer is that it just won't work with AD objects.
There is no way to do what you want. You will have to manually assign each attribute you want to copy.

Show logged in user's case details in IBM Case Manager

I am creating a Healthcare solution in IBM Case Manager Case Builder. I have a role called 'Patient'. I would like to show the case details of the patient when they log in. Is there any way I can show the case details when the patient logs in.
I have another role called 'Doctor', who can view the case details of any patient by clicking the link in the row of the list of returned search results on searching the patient. However, on the patient side, there is no search and they have to see their case details as soon as they log in.
If someone could point me in the right direction regarding this, I would really appreciate it.
Thanks in advance.
Allright, i guess there are many ways to accomplish this, but having thought about it a few minutes, here's a suggestion.
a. Create a script-adapter on the landing page (Case Manager page).
While it would be more intuitive to connect to the ecm.moel.desktop.onLogin event, the onLogin is within the navigator scope, and we need to be sure that ICM was started because we need to acces role info / ICM api. By using a scriptadapter on the landing page, we not only ensure the ICM context/api is loaded, but we'll also be able to use the ICM api to retrieve a case, and open it...
b. In the script adapter, do your role check; this can be done through:
var role = ecm.model.desktop.currentRole.name; (see this blog)
c. If the role is patient, find out the case(id's) you want to open; you might want to query using the ecm.model.SearchQuery or you could construct a pluginservice (see this redbook on services).
d. With the result of c, you'd then be able to open the case-page using the OpenCase event with a corresponding payload.
var caseId = "the id resulting from c.";
this.getSolution().retrieveCase(caseId, lang.hitch(this, function(caseFolder) {
this.onBroadcastEvent ('icm.OpenCase', {
"caseEditable": caseFolder.createEditable(),
"coordination": new icm.util.Coordination()
});
});

EWS SearchFilter.ContainsSubstring to filter on Sender Email Address

I'm trying to filter emails on Exchange Web Services using SearchFilter.ContainsSubstring as follows:
sfilter = New SearchFilter.ContainsSubstring(EmailMessageSchema.Sender, EmailAddress, ContainmentMode.Substring, ComparisonMode.IgnoreCase)
MailItems = service.FindItems(Folder.Id, sfilter, view)
Unfortunately this doesn't work, and I don't want to use Queries, because I can't guarantee that I can use features of Exchange Server 2013.
Composing a variety of requests in Fiddler, I can observe that if I remove the last character of the email address, then the filter works, remove the first character instead, works - put them back, broken.
So perhaps it's pedantic, and it has to be a true substring to qualify, so if I change the Containment mode to FullString - it doesn't work, so I can't do anything like a collection with Substring OR FullString.
It looks like I'll be able to do (Substring with last char missing AND Substring with first char missing), but it surely can't be that broken can it?
What can I do to get this to work?
Note that my code is in VB.NET, but I can't imagine that this is the problem.
Cheers,
Mark
I worked out that the IsEqualTo filter works with From/Sender, and it doesn't care about case-sensitivity issues, so it's probably what I should have tried to begin with.
The code to match an email address is:
sfilter = New SearchFilter.IsEqualTo(EmailMessageSchema.From, New EmailAddress(Message.FromAddress))
MailItems = service.FindItems(FailureFolder.Id, sfilter, iv)
I still don't know how to find all emails from users at the same domain though.
More Info:
I really needed to filter by Sender Domain and did that by pulling the entire folder contents down and filtering in .Net code. Even that causes problems.
Basically to keep things quick and tight, I tried to pull all the data with a PropertySet:
New PropertySet(BasePropertySet.IdOnly, EmailMessageSchema.Sender)
Filtering still didn't work, yet email addresses still showed in my list of items view. Well it turns out that the value of Message.Sender contains some kind of ActiveDirecty path in it until you call LoadPropertiesForItems. After LoadPropertiesForItems, it's an email address.
Note that my earlier attempt to filter at the server was scuppered because filtering would have to occur against the ActiveDirectory path style of string.
This is all highly confusing, and not at all user friendly.
If anybody has any idea on how to filter by email domain at the server, let me know!
Mark
What is your goal? Sender isn't a string property, so I'm not surprised that the results are odd with ContainsSubstring. I tried it against Office 365 and it worked, but older versions of Exchange may not be as "smart" about handling this kind of query. Depending on what you're trying to achieve, there may be a better filter.
if(emailSenderList.size() == 1) {
return new SearchFilter.IsEqualTo(EmailMessageSchema.From, emailSenderList.get(0));
}
return new SearchFilter.SearchFilterCollection(LogicalOperator.Or, emailSenderList.stream().map(em -> new SearchFilter.IsEqualTo(EmailMessageSchema.From, em)).toArray(SearchFilter.IsEqualTo[] :: new));

how to add a buddy to buddy list in twisted.words oscar (icq)

I've got a small bot communicating with users on ICQ, it's using Twisted.Words, Oscar protocol. I need to see their online status, but that seems to be only possible when I have them in my buddy list. So here comes the question:
How do I add a buddy to my buddy list in Twisted.Words Oscar?
That's pretty weird, but there seems to be nothing about it in the API docs and I couldn't find any good clues in the oscar.py source code. :\
Finally I came up with a solution, after hours of looking at the code of oscar.py and at OSCAR protocol documentation.
So here we go. Go to the function gotBuddyList(self, l) in this example:
http://twistedmatrix.com/documents/current/words/examples/oscardemo.py
You might have your own analogue, that's a callback function called when the SSI is received. It's bound like this:
self.requestSSI().addCallback(self.gotBuddyList)
So inside this gotBuddyList(self, l) function you put this:
self.groupAll = l[0][0]
In my case, this contains the first buddy group in my buddy list (which was created manually in advance, from a regular ICQ client). The l variable is the SSI received from the server and it contains your buddy groups, buddies in those groups and other stuff like settings or something. That's according to the OSCAR docs.
I'm going to add my buddies to the first group in my list. If you have your own cases or want to create a more flexible solution, you'll have to make more investigation on that.
Next, when you want to add a new buddy to your buddy list, you do this (assuming this is still inside one of your BOSConnection's implementation class methods):
buddy = oscar.SSIBuddy(the_uin_to_add) # put the UIN of the buddy to add in the argument
try:
buddyID = max(self.groupAll.usersToID.itervalues()) + 1 # incrementing the buddyID
except ValueError: # if the group is empty yet
buddyID = 1
self.groupAll.addUser(buddyID, buddy) # adding it to the group
self.addItemSSI(buddy) # actually sending the stuff to the server
And here you are, the buddy is in your list now. If he's online, you'll immediately get an updateBuddy event, containing the info about his online status and so on.
Here I couldn't really understand what the buddyID is. There's no info explaining it. But I finally assumed that it's just an inner ID inside the group the buddy is in. It's limited by 32767. I decided to go from 1 and increment it by one from the highest in the group each time.
That's all I have. I hope it can help someone once. If you can add anything or correct me, I'll be glad to see your comments!

SharePoint Workflow Error: "Unable to transform the input lookup data into the requested type" BUT only on New Item Creation

FYI to start, I am aware of how to properly set up an update to a lookup, and am 99% positive I've done this correctly.
I know this because When I set the workflow to automatically start when an Item is Changed, then it works perfectly. But when I simply change this setting so it will automatically start on New Item Creation, it Cancels the workflow and I get a "Coercion Failed: Unable to transform the input lookup data into the requested type." If both options are checked then it fails on creation, but simply clicking edit on the item properties, and the "Save" makes it work.
The workflow is on a Document Library and works as follows;
User selects the Work Task LookUp from a dropdown in the edit properties form after uploading, and then Saves the item (adding it to the document library). The workflow is suppose to then look at the Work Task LookUp selected, and pull the Account and Effective Date-Type lookUp ID's that Work Task item has, and sets the Document's identical fields to the same value.
Here is the code for the workflow if it helps;
If Current Item: Parent Task is not empty
If Current Item: Sub Task is not empty
Log Both are empty to workflow history list
Then Set Account to Work Tasks:Account
The Log Set Account to workflow history list
Then Set Effective Date and Type to WorkTasks: Effective Date and Type
The Log Set EffDateType to the workflow history list
This is all done in one step. I also added additional steps to test if the account and effective date type fields have been set properly, and if not to set them again. But everytime I run the workflow on change and it works, it always correctly sets these fields based upon the first Step (posted above) and the additional check logs to the history that they are not needed.
As an example, The lookUp for Integer for Tasks:Account is set to work as follows;
Date Source: Work Tasks (a list)
Field from Source: Account (a lookup)
Return Field as: Lookup ID (as Integer)
Find the List Item
Field: Title (from the Work Tasks list)
Value: Current Item: Parent Task (Which is a look up of the "Title"
Field from Work Tasks List, and is set to return the Value as a LookUp Value (As Text))
The Effective Date and Type setting is pretty much identical.
So anyone have any insight? I've tried running it as an impersonated Step, setting a workflow pause (for 1 minute), changing the lookup types incase I messed it up to start with, but ultimately the above workflow DOES work, but only when I set it to "Automatically start on the Change (edit) of an Item", NOT "Automatically start on New Item Creation" like I need to to do.
Oh yes, fyi, I am using SPServices CascadingDropDown on the Work Task and Sub Task fields of the doc Library form, but I honestly do not believe this has anything to do with my issue.
UPDATE:
I've talked with another developer, and he believes it is due to the issue that the workflow is occuring too quickly, before the item creates an ID for itself, which it needs to conduct the lookUps. He had me add another "Pause Workflow" to the very top of my workflow code (above the If conditions) and set it for 1 minute.
It then worked properly.
Downside is we want this to labeling to occur as close to item creation as possible. Because a view of the library relies on grouping based upon Account and Effective Date and Type. To add to this downer, Microsoft's Pause Workflow only allows for 1 minute or more, and then the timer used for this is often off, resulting in a pause longer than that. So far, every test is currently showing 2 minutes minimum on the pause.
A possible alternative solution for instantaniously populate the fileds is to use Javascript and SPServices to do the lookUp to the Task list to pull the account and effective date - type fields and then populate, but my Javascript is not very strong and I would need help doing this. If anyone has any suggestions, I would appreciate them.
(Answered in a question edit. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )
The OP wrote:
I don't know if it is the ID for the item after further testing. I changed the start of the workflow to wait until a field in the item changes. I set it to wait until the ID field is not 0 (since you cannot set to null), and it still does not work.
6/14/2012 4:13 PM Comment System Account Waiting on ID ​
6/14/2012 4:13 PM Comment System Account Waiting complete on ID ​
6/14/2012 4:13 PM Error System Account Coercion Failed: Unable to transform the input lookup data into the requested type.
I have tried other fields as well, like document ID value is not empty, and it will wait, log it finishing the wait, and then fail.
UPDATE This issue has something to do with the Parent Task field. I have solved the issue without having to wait for a period of time by setting the change from above to wait until the Parent Task field is not empty. It then completes the workflow fine.
Anyone know why there is a delay though? I've solved it, but still don't fully understand what takes it so long.
The main fault has been solved (hence the answer), and the remaining point about the reasons for the delay would probably be a discussion point or not specific enough for SO. Any further clarification can be edited in here.