19.10.2022, 10:15 | #3 |
Banned
|
Цитата:
The database is not a supported storage location for files. Use a different location. К слову, при миграции с Ax2012 надо сначала засосать файлы в базу данных, потом мигрировать ее, потом нажать на кнопку Migrate files и выгрузить их опять, на этот раз в Blob Storage. https://learn.microsoft.com/en-us/dy...hments-ax-2012 Работает примерно так: X++: class DocuFileMigrateDBtoAzure { public static void main(Args _args) { DocuValue docuValue; DocuRef docuRef; DocuType docType; System.IO.Stream fileStream; Microsoft.Dynamics.AX.Framework.FileManagement.DocumentLocation location; Microsoft.Dynamics.AX.Framework.FileManagement.IDocumentStorageProvider storageProvider; DataArea dataArea; ; while select dataArea { changecompany(dataArea.id) { docType = null; docType.skipTTSCheck(true); while select forupdate docType where docType.TypeGroup == DocuTypeGroup::File { if (docType.FilePlace == DocuFilePlace::Database) { docType.FilePlace = DocuFilePlace::Archive; docType.update(); } storageProvider = Docu::GetStorageProvider(docType, false, curUserId()); if (storageProvider == null) continue; while select forupdate docuValue where docuValue.StorageProviderId == 0 && docuValue.Type == DocuValueType::Others join docuRef where docuRef.ValueRecId == docuValue.RecId && docuRef.ActualCompanyId == docType.DataAreaId && docuRef.TypeId == docType.TypeId { fileStream = Binary::constructFromContainer(docuValue.File).getMemoryStream(); if (fileStream.Length == 0) continue; docuValue.FileId = newGuid(); location = storageProvider.SaveFile( docuValue.FileId, storageProvider.GenerateUniqueName(docuValue.OriginalFileName), System.Web.MimeMapping::GetMimeMapping(docuValue.OriginalFileName), fileStream); fileStream.Close(); if (location == null) continue; if (location.NavigationUri) { docuValue.Path = location.get_NavigationUri().ToString(); } if (location.AccessUri) { docuValue.AccessInformation = location.get_AccessUri().ToString(); } docuValue.StorageProviderId = storageProvider.ProviderId; docuValue.update(); } } } } } } Последний раз редактировалось EVGL; 19.10.2022 в 10:20. |
|
|
За это сообщение автора поблагодарили: Pandasama (2). |
|
|