OpenXML (Excel) Invalid URI: A port was expected because of there is a colon (':') present but the port could not be parsed - openxml

Currently I am using OpenXML to open my excel workbook,
so my code is like below:
using (SpreadsheetDocument myWorkbook = SpreadsheetDocument.Open(ExcelFilePath, true))
But If the excel file contains a cell text with hyperlink 192.168.0.1:88888 then it failed to open the excel document, and return this error message:
Exception:System.UriFormatException: Invalid URI: A port was expected because of there is a colon (':') present but the port could not be parsed.
Anyone know if any idea how to skip this error or any workaround?
Sample: http://www.uploadmb.com/dw.php?id=1368761562

Related

Creating an attachment in SharePoint from Microsoft Forms Response - Get File Content using path not working

I am trying to add contents and an attachment from a Form to a SharePoint list. However, the Get file content using path action in my flow is failing. The error I'm receiving says "Unauthorized" and in the file content box, I receive the following message:
"status": 401,
"message": "A potentially dangerous Request.Path value was detected from the client (?).",
"source": "apidod.connectorp.svc.ms"
The file path is as follows (minus the front of the path):
sites/HSMWINGATLANTIC_Supply_Requests/Shared%20Documents/Forms/AllItems.aspx?newTargetListUrl=%2Fsites%2FHSMWINGATLANTIC%5FSupply%5FRequests%2FShared%20Documents&viewpath=%2Fsites%2FHSMWINGATLANTIC%5FSupply%5FRequests%2FShared%20Documents%2FForms%2FAllItems%2Easpx&id=%2Fsites%2FHSMWINGATLANTIC%5FSupply%5FRequests%2FShared%20Documents%2FApps%2FMicrosoft%20Forms%20Fairfax%2FVehicle%20Rental%20Request%2FSupporting%20Documents&viewid=55590b8b%2D4994%2D4e8b%2D804b%2D24f4774c21e920220815 - HSM-40 Truck Request for 15 AUG 20_Charles Power 1.pdf
c.d.power
For that Get File content using path you would need a relative path without the site url part. You can actually extract the correct path with an expression.
In the example below I retrieve the link property from the Attachment question answer value. I use a json function to turn it into an array, since Microsoft returns a string value for some reason ;)
After that I use nthindexof to determine at which forward slash (starting position of string) I need to slice with a slice function, in this case the 7th instance, which is index 6.
This should retrieve the part which we need for a get file content using path action. With a decodeUriComponent function I make sure the %20 is turned back into space characters.
Make sure you update the question id to your question id.
decodeUriComponent(slice(json(outputs('Get_response_details')?['body/re67e0cfcd95d488593347d93f2728204'])[0]['link'], nthindexof(json(outputs('Get_response_details')?['body/re67e0cfcd95d488593347d93f2728204'])[0]['link'], '/', 6)))
I found the solution to the issue. This wasn’t working because it is a group form and form responses are sent to the group’s SharePoint site; not the user’s OneDrive. Therefore, the Get file content action should be using the SharePoint connector instead of OneDrive.

Envoy access logs fields host

I have one question regarding the access log of envoy:
I use the field host: %REQ(:AUTHORITY)%, can I remove the port?
Or is there another fields which include the AUTHORITY and doesn't include the port?
First, the "%REQ(:AUTHORITY)%" field does not contain any information about the port. Look at this official documentation:
Format strings are plain strings, specified using the format key. They may contain either command operators or other characters interpreted as a plain string. The access log formatter does not make any assumptions about a new line separator, so one has to specified as part of the format string. See the default format for an example.
If custom format string is not specified, Envoy uses the following default format:
[%START_TIME%] "%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%"
%RESPONSE_CODE% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DURATION%
%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% "%REQ(X-FORWARDED-FOR)%" "%REQ(USER-AGENT)%"
"%REQ(X-REQUEST-ID)%" "%REQ(:AUTHORITY)%" "%UPSTREAM_HOST%"\n
Example of the default Envoy access log format:
[2016-04-15T20:17:00.310Z] "POST /api/v1/locations HTTP/2" 204 - 154 0 226 100 "10.0.35.28"
"nsq2http" "cc21d9b0-cf5c-432b-8c7e-98aeb7988cd2" "locations" "tcp://10.0.2.1:80"
Field "%REQ(:AUTHORITY)%" shows value "locations" and field "%UPSTREAM_HOST%" shows "tcp://10.0.2.1:80".
You can customise your log format based on format keys.
Here you can find good article about understanding these logs. Field "%REQ(:AUTHORITY)%" is value of the Host (HTTP/1.1) or Authority (HTTP/2) header. Look at this picture to better understand.
I suppose you want to edit the field "%UPSTREAM_HOST%" It is impossible to remove the port from this field. You can find documentation with description of these fields here:
%UPSTREAM_HOST%
Upstream host URL (e.g., tcp://ip:port for TCP connections).
I haven't found any other field that returns just an IP address without a port.
Answering your question:
I use the field host: %REQ(:AUTHORITY)% , can I remove the port ?
No, because this field does not return a port at all.
is there another fields which include the AUTHORITY and doesnt include the port?
You can use %REQ(:AUTHORITY)% field without "%UPSTREAM_HOST%" field. You can do this by creating your custom log format. As far as I know it is impossible to have only IP adress without port in the logs.

Export contents as csv in Drupal 8

Have added new repository items and filled all the fields with appropriate details. I wish to export this content as CSV, XML so that changes can be made in the downloaded CSV file and then import this CSV or sync automatically with the uploaded content type.
How do I proceed?
An AJAX HTTP error occurred.
HTTP Result Code: 200 Debugging information follows.
Path: /batch?id=95&op=do_nojs&op=do
StatusText: OK

Getting a strange error from Watson's Document Conversion service

I am trying to convert some documents into answer units with Watson's Document Conversion service, using the watson-developer-cloud Javascript library in Node.js. Certain ones (an example is at IBM internal link and is a .DOCX file) return this error:
Error: code:400 error: The supplied data appears to be in the Office
2007+ XML. You are calling the part of POI that deals with OLE2 Office
Documents. You need to call a different part of POI to process this
data (eg XSSF instead of HSSF)
If I try to convert it via the document conversion demo site, it seems to convert without error. My program downloads the file from the source, writes it to disk, and then uploads it to the Document Conversion service via the above mentioned library.
Is there any way around this error? Consider that this conversion is part of a massive automated conversion of thousands of documents, so manual handling for these outliers is out of the question.
The service attempts to autodetect the media type of the uploaded file using the first few bytes of the file, and the file name.
If the file name is unavailable (i.e., not passed in by your user), you could provide the media type of the file you are uploading in the file portion of the convert call:
file: {
value: fs.createReadStream('filename'),
options: {
contentType: 'application/vnd.openxmlformats officedocument.wordprocessingml.document'
}
}

Dynamics CRM: Odata query that checks if the file attachment file name contains the unicode '#'

Scenario: I have a custom entity with attachments in Dynamics CRM 2011. I want to query those attachments with file name that contains a hash tag ('#'). Say I have attached a few text documents. kdk#ie.txt, Report.txt, & k!ke.txt to the custom entity.
Here are my results to my Odata query.
Error Code:
//ORGANIATION/XRMServices/2011/OrganizationData.svc/AnnotationSet?$filter=ObjectId/Id eq guid'{GUID HERE}' and IsDocument eq true and substringof('#',FileName)
Return: Bad Request
Because it is a unicode I tried the following on the string parameter.
'\u0023'
'U+0021'
'w%u0023'
But return is either 0 or Bad Request
I tested '!' & 'Report' it was successful return 1 respectively. It seem it only does not work for the #.
Any ideas why I am not getting the result I expected?
Really appreciate it.
TIA
"#" sign is a special character in a URL. It has to be encoded to not create an invalid URL. msdn.microsoft.com/en-us/library/aa226544(SQL.80).aspx