I decided to switch to v31.0 metadata, needed to update some code to make it compile, but that's fine. However, now it's not working the way it used to. My code is in C#, it was used to retrieve page layouts and worked just fine. Here it is:
SFDCMetadata.RetrieveRequest rr = new SFDCMetadata.RetrieveRequest();
SFDCMetadata.Package package = new SFDCMetadata.Package();
SFDCMetadata.PackageTypeMembers ptm = new SFDCMetadata.PackageTypeMembers();
ptm.name = "Layout";
ptm.members = new string[] { "*" };
package.types = new SFDCMetadata.PackageTypeMembers[] { ptm };
rr.singlePackage = true;
rr.unpackaged = package;
SFDCMetadata.AsyncResult res = port.retrieve(sh, null, rr);
Thread.Sleep(1000);
SFDCMetadata.RetrieveResult retRes = port.checkRetrieveStatus(sh, null, res.id);
while (!retRes.done)
{
retRes = port.checkRetrieveStatus(sh, null, res.id);
Thread.Sleep(500);
}
List<FileInfo> fis = DecompressToFiles(retRes.zipFile, ThisAddIn.TempDirectory, objName);
Now it breaks in a very weird way. It passes the port.retrieve() line, does a couple of iterations inside the while loop (while retRes.done is false), but then just as I expect the retRes.done to turn to true to continue getting the files, I'm getting the following exception: INVALID_LOCATOR: Retrieve result has been deleted
It's like instead of returning the result to me Salesforce just deletes it on the server. Anyone has any idea what's going on?