Friday, March 8, 2013

Outlook to Ical and google

So I'm trying to make it so that my wife can see my calendar which I use at work.  This was more difficult then I thought.  Biggest problem was the work computer.  Second was Microsoft and/or Google's messed up ical implementations.  The automated publish options didn't work for me because i couldn't do the whole calendar, and publishing to CalDav didn't work, probably because of the proxy firewall.  I could publish to Office but then you can only really see it with Outlook, and I wanted to use google. 

Ok so as far as problems normal people might have, they involve the ical file.  For extra joy, Google doesn't tell you what the problem is.  Since I only got it to work once the this validator passed my file, I assume Google also uses ical4j.  Microsoft's main problem was that when publishing events with a timezone, my timezone didn't have a label (e.g. GMT, EST EDT).  Even after giving it one in settings it wouldn't export the timezone with an TZID identifier.  It just said "TZID:".  Interestingly this didn't cause the error, it was when the parser tried to read a time stamp that looked like "TZID=:20130101000000" (rather than "TZID=timezone:2013...").  Having no characters between the = and : caused the parser to pick up a null rather than an empty string, so I didn't even get friendly error messages to help me figure this out.  The other problem is how Microsoft wraps long lines.  ical files have to be a certain line width.  lines are terminated with CRLF and then the next line starts with one space or a tab.  MS uses tabs.  Both the validator and google didn't like this, but AFAIK MS is correct in doing that.  Running the file through simple search and replaces fixed these problems.


The next big question was where to put this file.  My work computer is locked down and the proxy blocks most file storage sites.  Windows 7 doesn't come with Web Folders.  These can refer to the WebDAV folders or the frontpoint server extension version.  Comcast which I used to use, uses only FPSE web folders.  FTP upload was blocked (mostly, more on that later).  Because of this I'd been using MS SkyDrive for online files.  But both that and Google Drive don't give you direct dl links, so GCal wouldn't be able to parse it. 

Icalx.com looked promising, I think I got a simple HTTP PUT to upload the file a couple of times with a firefox extension.   But doing it from my own program was another story.  I have a lot of trouble automating the web through my work proxy.  The only way I usually have success is to use the IE browser itself through MS Internet Controls  (SHDocVw and ieframe.dll).  Especially when I need to authenticate site and the proxy, I just can't do it.  WinHTTP, MSXML, WebRequest, it just never works, especially if it's anything other than a GET.  So FTP is blocked from uploading, but on Windows firewall.  So if the program has access already, you can do it.  ftp.exe... blocked, the only thing that had access was IE.  And the only way I could figure out how to upload was with the FTP Explorer view.  After trying Scripting.FileSystemObject, I realized there was another COM library, shell32, Shell Automation.  Most of the documentation for this is about using the shell to zip and unzip files, but you can use for http also.  There are a few quirks.  The best of which is that none of the flags for CopyHere work.   Which means no overwriting files, no hiding progress bars.  And CopyHere is asyncronous but with no way to get progress or block.  Now windows firewall only blocks some ftp commands.  So I could use FTPWebRequest to delete the file, without authentication problems, and also use it to check the modification date on the file to see when the upload was done. 

Not very pretty or efficient, but it finally works.  Hopefully she looks at it.


See what I did

No comments:

Post a Comment