opentext - How to download a LiveLink (OpenText) file using REST API and .Net (C# /VB)
问题描述
Using LiveLink Server 16.2.9 (2019-06), build 851
This is the code I use to download a LiveLink file named Active_Time.xlsx. If I paste the link below in the browser, then the file is downloaded. However, when using this code the result is a small XML file (see bottom)
Dim remoteUri As String = "https://OurServer.com/livelink/livelink.exe?func=ll&objId=33100345&objAction=download"
Using client = New Net.WebClient()
client.Credentials = New Net.NetworkCredential(username, password, domain)
client.DownloadFile(remoteUri, "C:\temp\Active_Time.xlsx)
Console.WriteLine("File extracted.")
client.Dispose()
End Using
Something is downloaded but not the Excel file I expected. This is what I get if I edit the file with Notepad.
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script src="./jquery.min.js?v=16.6.0.2315"></script>
<script src="./login1/getfragment.js?v=16.6.0.2315"></script>
</head>
<body>
<noscript>
<p><strong>Note:</strong>Since your browser does not support Javascript, you must press the Continue button once to proceed.</p>
</noscript>
<form action="login" method="get">
<div>
<input type="hidden" name="RFA" value="eyJhbGciOiJub25lIn0.eyJwb3N0VGlja2V0Ijp0cnVlLCJwb3N0UGFyYW1zIjp0cnVlLCJsb2dvblN0eWxlIjoic2lnbmluLWNzIiwidXhWZXJzaW9uIjoxLCJmb3J3YXJkQWRkcmVzcyI6Imh0dHBzOi8vY2Rtcy50YXMtY2FuLmNvbS9saXZlbGluay9saXZlbGluay5leGU_ZnVuYz1vdGRzaW50ZWdyYXRpb24ucmVkaXJlY3QmTmV4dFVSTD1odHRwcyUzQSUyRiUyRmNkbXMlMkV0YXMlMkRjYW4lMkVjb20lMkZsaXZlbGluayUyRmxpdmVsaW5rJTJFZXhlJTNGZnVuYyUzRGxsJTI2b2JqSWQlM0QzMzY1MjI3MSUyNm9iakFjdGlvbiUzRGRvd25sb2FkJTI2bmV4dHVybCUzRCUyNTJGbGl2ZWxpbmslMjUyRmxpdmVsaW5rJTJFZXhlJTI1M0ZmdW5jJTI1M0RsbCUyNTI2b2JqSWQlMjUzRDMzMTQwMzE1JTI1MjZvYmpBY3Rpb24lMjUzRGJyb3dzZSUyNTI2bG9nU3RvcENvbmRpdGlvbklEJTI1M0QxMTYwODAxXzEzOTA1Mzg5MF8xX2xvYyIsInJlc291cmNlSUQiOiIxYTEzYzg2Mi0zZGY2LTRhNGYtYWU3MC1kYThhNmY0ZGI4YzIifQ">
<input type="hidden" name="fragment" id="fragment">
</div>
<noscript>
<div><input type="submit" value="Continue"></div>
</noscript>
</form>
</body>
解决方案
看起来你没有通过身份验证?您应该使用其余的 api。
例子
https://<server.ext>/<livelink-root>/api/v2/nodes/2000
推荐阅读
- html - 即使给定相同的属性和值,按钮的大小也不同
- mongodb - 无法启动 MongoDB - IndexCatalog 留下了索引
- c# - UWP VS2017 - Xaml 内部错误错误 WMC9999:此成员“值”有多个项目,请使用 Items 属性
- php - Laravel proc_open(): 分叉失败
- android - Circular background for toolbar icons
- odoo - 如何获取客户发票行数?
- python - 具有多个 tbodies 的 Python Dash DataTable
- bash - How to format many uses of the && operator with multi line script?
- create-react-app - 无法编译 create-react-app。找不到模块“ReactPropTypesSecret”
- excel - Understand the pro and cons of the GoTo statement