receiving report file into Windows Temp folder which is not accessible, please suggest what to do
Hi @abuzuhri
I am Facing an issue with the report file which is being received into the C:/Windows/Temp folder but this folder is not accessible so despite receiving the file I am unable to access the file or read the file content. so requesting you to please suggest how can I receive the file in my desired location or any drive like d:\ or e:\ so that I can easily access it. or suggest the other way to access it. Note: The data I am importing is more than 50k or 100k
e.g. ReportManager reportManager = new ReportManager(amazonConnection); var products = reportManager.GetProducts(); //GET_MERCHANT_LISTINGS_ALL_DATA
so when using above code its getting timed out hence I am trying to import the file which is faster than this. Kindly reply me ASAP.
Below is my webapi method which is returning me the received report file path
[HttpGet("GetMerchantListingsReportFile")]
public string GetMerchantListingsReportFile(string mRefreshToken, string mClientId, string mClientSecret)
{
AmazonConnection amazonConnection = new AmazonConnection(new AmazonCredential()
{
AccessKey = "XXXXXXXXXXXXXX",
SecretKey = "XXXXXXXXXXXXXX",
RoleArn = "XXXXXXXXXXXXXX",
ClientId = mClientId,
ClientSecret = mClientSecret,
RefreshToken = mRefreshToken,
MarketPlace = MarketPlace.GetMarketPlaceByID("ATVPDKIKX0DER"),
});
var parameters = new ParameterCreateReportSpecification();
parameters.reportType = ReportTypes.GET_MERCHANT_LISTINGS_ALL_DATA;
parameters.marketplaceIds = new MarketplaceIds();
parameters.marketplaceIds.Add("ATVPDKIKX0DER");
parameters.reportOptions = new FikaAmazonAPI.AmazonSpApiSDK.Models.Reports.ReportOptions();
var reportId = amazonConnection.Reports.CreateReport(parameters);
var filePath = string.Empty;
string ReportDocumentId = string.Empty;
while (string.IsNullOrEmpty(ReportDocumentId))
{
var reportData = amazonConnection.Reports.GetReport(reportId);
if (!string.IsNullOrEmpty(reportData.ReportDocumentId))
{
filePath = amazonConnection.Reports.GetReportFile(reportData.ReportDocumentId);
break;
}
}
return filePath;
}
Hi,
result of: filePath (= amazonConnection.Reports.GetReportFile(reportData.ReportDocumentId);) is string tempFilePath = Path.Combine(Path.GetTempPath() + fileName); (ReportService.cs) => Path.GetTempPath() = //Returns the path of the current user's temporary folder. usually it should be this path: C:\Users[WindowsUsername]\AppData\Local\Temp See Windows Settings - System Variables maybe this will help you
will try in future use memory