object IdConnectionIntercept: TIdConnectionIntercept
Left = 512
Top = 64
end
object IdSSLIOHandlerSocketOpenSSL: TIdSSLIOHandlerSocketOpenSSL
Intercept = IdConnectionIntercept
MaxLineAction = maException
Port = 0
DefaultPort = 0
SSLOptions.Method = sslvTLSv1_2
SSLOptions.SSLVersions = [sslvTLSv1_2]
SSLOptions.Mode = sslmUnassigned
SSLOptions.VerifyMode = []
SSLOptions.VerifyDepth = 0
Left = 456
Top = 48
end
object IdWebDAV: TIdWebDAV
Intercept = IdConnectionIntercept
IOHandler = IdSSLIOHandlerSocketOpenSSL
OnWork = IdWebDAVWork
OnWorkBegin = IdWebDAVWorkBegin
OnWorkEnd = IdWebDAVWorkEnd
HandleRedirects = True
ProxyParams.BasicAuthentication = False
ProxyParams.ProxyPort = 0
Request.CacheControl = 'no-cache'
Request.Connection = 'Keep-Alive'
Request.ContentEncoding = 'utf-8'
Request.ContentLength = -1
Request.ContentRangeEnd = -1
Request.ContentRangeStart = -1
Request.ContentRangeInstanceLength = -1
Request.Accept = 'text/
html,application/xhtml+
xml,application/
xml;q=0.9,*/*;q=0.8'
Request.AcceptCharSet = 'utf-8'
Request.BasicAuthentication = True
Request.UserAgent = 'Mozilla/3.0 (compatible;
Indy Library)'
Request.Ranges.Units = 'bytes'
Request.Ranges = <>
HTTPOptions = [hoForceEncodeParams]
Left = 400
Top = 32
end
// datei öffnen
stream:=TMemoryStream.Create;
ss:=TStringList.Create;
IdWebDAV.Request.URL:=....;
IdWebDAV.Request.Username:=....;
IdWebDAV.Request.Password:=....;
IdWebDAV.Request.CustomHeaders.Clear;
try
IdWebDAV.Get(<
URL der Datei>, stream);
stream.Position:=0;
ss.LoadFromStream(stream);
except
on E:
Exception do MessageDlg(E.Message + ' ('+<
URL der Datei>+')', mtWarning, [mbOK], 0);
end;
ss.Free;
stream.Free;
// dateiverzeichnis abfragen
WebDAVXml:IXMLDocument ;
xmlResponse:=TMemoryStream.Create;
IdWebDAV.DAVPropFind(Serverpfad, nil, xmlResponse, '4', 1, 4); // Die '1' lädt das aktuelle Verzeichnis, die Tiefe kann hier bestimmt werden
WebDAVXml:=TXmlDocument.Create(nil);
try
WebDAVXml.LoadFromStream(xmlResponse);
...
xml analysieren
except
.... //
xml-Fehler
end;
xmlResponse.free;