Ok, with the help of Glen Scales I got this to work. It seems that PowerShell's PublicFolderIdParameter
type (the type of the Identity
parameter) accepts a sequence of Hexadecimal characters representing the EntryID. So to translate an EWS ID to a PowerShell-accepted ID, we can use this code:
Folder myFolder = Folder.Bind("whatever");
var ewsId = new AlternatePublicFolderId(IdFormat.EwsId, myFolder.Id.UniqueId);
var hexId = _service.ConvertId(ewsId, IdFormat.HexEntryId) as AlternatePublicFolderId;
string idForPowerShell = hexId.FolderId;