I have tried code from here https://www.reso.org/c-sharp-photo-download-example/ but it's not working and show picture size 1KB.
Below Code I tried
using (librets.GetObjectRequest request = new GetObjectRequest("Property", "Photo"))
{
request.AddAllObjects(CurrentMLS);
GetObjectResponse response = session.GetObject(request);
foreach (ObjectDescriptor objectDescriptor in response)
{
string objectKey = objectDescriptor.GetObjectKey();
int objectId = objectDescriptor.GetObjectId();
string contentType = objectDescriptor.GetContentType();
string description = objectDescriptor.GetDescription();
Console.Write(objectKey + " object #" + objectId);
if (description.Length != 0)
Console.Write(", desription: " + description);
Console.WriteLine();
string outputFileName = photoFilePath+"\\"+objectKey + "-" + objectId + ".jpg";
Stream outputStream = File.OpenWrite(outputFileName);
const int BUFFER_SIZE = 1024;
Stream stream = objectDescriptor.GetDataStream();
byte[] buffer = new Byte[BUFFER_SIZE];
int bytesRead;
while ((bytesRead = stream.Read(buffer, 0, BUFFER_SIZE)) > 0)
{
outputStream.Write(buffer, 0, bytesRead);
}
outputStream.Close();
}
}
It doesn't look like you're filtering by contentType. If you trust the RETS server to send properly formatted content type strings, then you could filter the objects down to JPEGs only using something like this: