Skip to main content

From Basecamp to MS Project

I don't hide the fact that I really like Basecamp from anyone I know. Free for single projects and with a relatively low price-point, I've gotten one of my clients to use it for basic tracking of projects. I've also logged into Huddle ( a similar DotNet offering from British-based Ninian Solutions)) but haven't gotten right into it just yet.



One of the great things offered by Basecamp is the Basecamp API - which they describe as plain vanilla xml over HTTP.  A lot of the samples that integrate with Basecamp are primarily web-based or widgets. I think that's primarily because of the synergy of the Web 2.0 world - but you can just as easily integrate Basecamp with Windows-based apps directly with a little bit of COM automation.



While I did some basic stuff like posting messages and updating items with the API, I found imified more useful to do updates over instant messenger instead.



However, when one of our sales managers asked for an MS Project file of all the outstanding Basecamp projects, I knew it was a challenge I wanted to face.(in FoxPro and West-Wind IP Tools - of course!)



I created a number of classes to accomplish this, using collections and custom classes.



PUBLIC loBase

loBase = CREATEOBJECT("Custom")

loBase.AddObject("Projects","Collection")

loBase.AddObject("Users","Collection")

loBase.AddObject("Companies","Collection")



But the basis for everything else was pretty straight forward:

lox = lo.gethttp()

? lox.httpconnect(basecampsite,"username","password",.t.)

 lox.nhttppostmode = 4

LOCAL loXML

lcPosts = " "

lnText = 0

lnResult=lox.HTTPGetEx("/project/list",@lcPosts,@lnText,"Accept: application/xml")



loXML = CREATEOBJECT("MSXML.DomDocument")

IF loXML.LoadXML(lcPosts)

    loProjects = loXML.selectnodes("//project")

    FOR lni = 1 TO loProjects.length

        loProj =loProjects.item(lni-1)

        WITH loBase.Projects

        .Add(NEWOBJECT("cbaseproject"))

        .Item(.Count).ProjectName =loProj.selectsinglenode("name").nodetypedvalue

        .Item(.Count).ProjectID =loProj.selectsinglenode("id").nodetypedvalue

        .Item(.Count).Status =loProj.selectsinglenode("status").nodetypedvalue

        ENDWITH

    ENDFOR

ENDIF



I did a similar part for Companies and Users in the system. This was necessary to link projects to individuals and the like.



Within the cbaseproject class, I created a method called GetTasks , GetPeople and GetMilestones that all looked pretty much like this:

DEFINE CLASS cBaseProject AS Custom

    ProjectID = 0

    ProjectName = ""

    Status = ""

    Company = ""

   

    PROCEDURE GetTasks

    lcPosts = " "

    lnText = 0

   

** Reconnect


lnResult=lox.HTTPGetEx("/projects/"+THIS.ProjectID+"/todos/lists",@lcPosts,@lnText,"Accept: application/xml")

loXML = CREATEOBJECT("MSXML.DomDocument")

IF loXML.LoadXML(lcPosts)

    loProjects = loXML.selectnodes("//todo-list")

    THIS.AddObject("TaskLists","Collection")

    FOR lni = 1 TO loProjects.length

        loProj =loProjects.item(lni-1)

        WITH THIS.TaskLists

            .Add(NEWOBJECT("cbasetask"))

            .Item(.Count).TaskName =loProj.selectsinglenode("name").nodetypedvalue

            .Item(.Count).Description =loProj.selectsinglenode("description").nodetypedvalue

            .Item(.Count).ID =loProj.selectsinglenode("id").nodetypedvalue

        ENDWITH

    ENDFOR

ENDIF



    ENDPROC

   

    PROCEDURE GetMilestones

    lcPosts = " "

    lnText = 0

   

** Reconnect

lnResult=lox.HTTPGetEx("/projects/"+THIS.ProjectID+"/milestones/list",@lcPosts,@lnText,"Accept: application/xml")

loXML = CREATEOBJECT("MSXML.DomDocument")

IF loXML.LoadXML(lcPosts)

    loProjects = loXML.selectnodes("//milestone")

    THIS.AddObject("MileStones","Collection")

    FOR lni = 1 TO loProjects.length

        loProj =loProjects.item(lni-1)

        WITH THIS.Milestones

            .Add(NEWOBJECT("cMilestone"))

            .Item(.Count).Title =loProj.selectsinglenode("title").nodetypedvalue

            .Item(.Count).ID =loProj.selectsinglenode("id").nodetypedvalue

            .Item(.Count).Deadline =loProj.selectsinglenode("deadline").nodetypedvalue

            .Item(.Count).xml = loProj.Xml

            .Item(.Count).person = getperson(loProj.selectsinglenode("responsible-party-id").nodetypedvalue)

            TRY

            .Item(.Count).Completed = loProj.selectsinglenode("completed").nodetypedvalue="true"

            .Item(.Count).CompletedOn =loProj.selectsinglenode("completed-on").nodetypedvalue

            CATCH

            ENDTRY

        ENDWITH

    ENDFOR

ENDIF



    ENDPROC



  

ENDDEFINE



From here, I was now simply going to create or update my MS Project file.



LOCAL lcText

loapp = GETOBJECT(,"MSProject.application")

loProject = loapp.activeproject



LOCAL lnStartRow

lnStartRow=0

lcText = ""

LOCAL loP

FOR EACH loP IN lobase.projects

    IF NOT PEMSTATUS(lop,"milestones",5)

        lop.GetMilestones()

    ENDIF

    loProject.Tasks.add(lop.projectname)

    lnStartRow=lnStartRow+1

    loApp.selectrange(lnStartRow,3,.f.)

    loApp.outlineoutdent()

    lnS = 0

    FOR EACH loM IN lop.Milestones

        lnS = lns+1

        tsk = loProject.Tasks.add(lom.Title)

        tsk.milestone = .t.

        lnStartRow=lnStartRow+1

        loApp.selectrange(lnStartRow,3,.f.)

        IF lnS=1

            loApp.outlineindent()

        ENDIF

        IF NOT lom.Completed

            *!* ? lom.Title + " due on " + lom.deadline +" by "+lom.person

            tsk.finish = DATE(VAL(LEFT(lom.deadline,4)),VAL(SUBSTR(lom.deadline,6,2)),VAL(RIGHT(lom.deadline,2)))

        ELSE

            tsk.percentcomplete = 100

            tsk.finish = DATE(VAL(LEFT(lom.completedon,4)),VAL(SUBSTR(lom.completedon,6,2)),VAL(SUBSTR(lom.completedon,9,2)))

        ENDIF

    ENDFOR

ENDFOR





The end result? I can give a project file that always includes the latest updates to those who like the graphics appeal and project-reporting of MS Project.





Basecamp API



Powered by ScribeFire.

Comments

I agree w/ Mr. Mabusela....you just made my assignment easier. Our last assignment for the term is to create a gantt chart for training a group of data analysts. Thus, the last assignment requires us to learn a new software package. Project Libre is definitely easier than MS 2013 and you made it even easier still. Thank you, Project Woman!

Popular posts from this blog

Well, that explains CodePlex...

In a move that will be sure to anger open source (or rather anti-paid software, anti-Microsoft open source)  zealots, Microsoft is planning to buy GitHub.

A year ago, I mused about why Microsoft would shut down CodePlex and how the world needs competing source code repositories to be strong. I'm not the only one per this Slashdot article :
"...people have warned about GitHub becoming as large as it did as problematic because it concentrates too much of the power to make or break the open source world in a single entity, moreso because there were valid questions about GitHubs financial viability...." - Jacques Mattheij

I will be interested in seeing this play out - whether developers jump ship or not. Have all the efforts Microsoft has made in pushing towards open source be seen as genuine or will all the zealots jump ship or maybe even attack?

Microsoft's comment about why they shut down CodePlex referred to how spammers were using CodePlex. Well, GitHub has its own …

FoxInCloud Stats

FoxInCloud sent this link a while back about their statistics regarding visits to their site:

http://foxincloud.com/blog/2017/12/27/VFP-community-lessons-from-foxincloud-site.html



What's interesting here is the breakdown of people. Yes, I think it's understandable that the Fox community is getting older.

Another factor is the growth of the mobile and web environments taking over development. These environments really do push people towards the newer non-SQL or free SQL/hosted environments but more towards hosted storage options like Amazon and Google. A tool like FoxInCloud that helps MOVE existing applications to the cloud inherently competes with those environments.

But FoxInCloud also allows developers to extend their application further by giving them a starting point using Javascript and the basic CSS (such as Bootstrap). If you're not rebuilding your application from scratch, it's certainly a great step forward.

Attending Southwest Fox 2019 could change your life - Find out how

Southwest Fox is coming up in October and as I do every year, I spoke with the organizers Rick, Doug and Tamar on the FoxShow.

Deadlines for Southwest Fox:
Super-saver price (before July 1): $695
Early-bird price (before August 1): $770
Regular price (August 1 and later): $820
This year, I took a different approach with separate shows for each organizer but the main message is still the same : July 1st is their Go/No-Go date.

Conferences don't talk about this very often. I don't think developers really question if Apple will hold their WWDC in June or Microsoft will hold their Build conference - but that's because those conferences are vendor-led.

Southwest Fox is a community-driven conference - it's not driven by a company with an agenda. Listen to the interviews and you can hear how important each of the organizers feel the live connection between speakers and among attendees.