Adding project to task while creating the task
Hi, First of all, great work here. I can currently manage to create a task, and assign it to myself (for testing purposes). I want to add the task to a project while creating it, but it doesn't seem to work. That is, the project is not added to the task when I look in Asana (browser).
public void CreateTask()
{
AsanaProject project = myProject;
AsanaTask task = new AsanaTask(myWorkspace);
task.Name = "Test task!";
task.Notes = "asd asd asd asd lots of text";
task.Assignee = me;
task.DueOn = DateTime.Now.AddHours(4);
task.AddProject(project, asana);
task.Save(asana);
}
It should be noted that me, asana, myProject, and myWorkspace are correctly fetched before calling CreateTask().
I tried looking around in the source code, but I can't seem to find the reason why the project is not added to the new task.
The project has the following properties:
Archived = false
...
IsObjectLocal = false
...
Name = "<name of the project in Asana>"
...
base.Host.APIKey = "<my Asana API key>"
base.Host.AuthType = Basic
base.Host.EncodedAPIKey = "<some encoded key here>"
...
base.ID = <ID number of the project>
...
The other values represented by "..." are all null.
That's a limitation of the current implementation. I'm working on a new implementation of Asana in C# which should implement 100% of the Asana API. While this one is a very good job (kudos acron0!), even after adding loads of functionality and writing the 2.0 version of it (my fork, 2.0 branch), I found this way of implementation to be a bit limiting. Mine will allow that what you speak of.
For now, with AsanaNet, you need to Save the task first and only then you can add the project/tag.
Mine should be ready in 1-2 months: https://github.com/niieani/AsanaSharp
Cheers Bazyli ;) For me, this project was entirely experimental -- I have never actually used AsanaNet in production. So yes, the design is pretty edgy and limiting in a number of cases. I was impressed it was useful to anyone at all!
But I would definitely put your time and effort into AsanaSharp. I have no plans to maintain AsanaNet.
This issue is now published on WorksHub. If you would like to work on this issue you can start work on the WorksHub Issue Details page.
This issue is now published on WorksHub. If you would like to work on this issue you can start work on the WorksHub Issue Details page.