ADN Club > Vault API

Как получить КОРРЕКТНУЮ ссылку на файл/папку для дальнейшей отправки по почте?

(1/2) > >>

Пашин Евгений:
Добрый день, коллеги.

Нужно получить ссылку на файл/папку, что затем выслать её в почтовом уведомлении.

Есть решение получения ссылки, но когда высылаю её на почту, то при нажатии на неё мышкой ничего не происходит.

--- Код - C# [Выбрать] ---using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms; using Autodesk.Connectivity.WebServices; namespace LinkMaestro{    public partial class SettingsDialog : Form    {        private bool m_isVaultPro;        private Dictionary<LinkFormat, string> m_linkFormatMap = new Dictionary<LinkFormat, string>()        {            {LinkFormat.VaultExplorer, "Vault Explorer"},            {LinkFormat.VaultPath, "Vault Path"},            {LinkFormat.WebClient, "Web Browser"}        };         public Settings Settings        {            get            {                Settings settings = new Settings()                {                    FileLinkFormat = ConvertLinkFormat(m_fileLinkComboBox.Text),                    FolderLinkFormat = ConvertLinkFormat(m_folderLinkComboBox.Text),                    ItemLinkFormat = ConvertLinkFormat(m_itemLinkComboBox.Text),                    ChangeOrderLinkFormat = ConvertLinkFormat(m_coLinkComboBox.Text),                    MultiWorkgroups = m_multiCheckBox.Checked,                    HTMLFormat = m_htmlFormatCheckBox.Checked                };                 return settings;            }             set            {                m_fileLinkComboBox.Text = ConvertLinkFormat(value.FileLinkFormat);                m_folderLinkComboBox.Text = ConvertLinkFormat(value.FolderLinkFormat);                m_itemLinkComboBox.Text = ConvertLinkFormat(value.ItemLinkFormat);                m_coLinkComboBox.Text = ConvertLinkFormat(value.ChangeOrderLinkFormat);                m_multiCheckBox.Checked = value.MultiWorkgroups;                m_htmlFormatCheckBox.Checked = value.HTMLFormat;            }        }         public SettingsDialog(Settings settings, bool isVaultPro)        {            InitializeComponent();             m_isVaultPro = isVaultPro;             if (!m_isVaultPro)            {                m_itemLinkComboBox.Enabled = false;                m_coLinkComboBox.Enabled = false;            }             this.Settings = settings;             m_okButton.Select();            m_descriptionLabel.Text = String.Empty;        }           private string ConvertLinkFormat(LinkFormat format)        {            string debug = m_linkFormatMap[format];            return m_linkFormatMap[format];        }         private LinkFormat ConvertLinkFormat(string format)        {            return m_linkFormatMap.First(n => n.Value == format).Key;        }         private void m_okButton_Click(object sender, EventArgs e)        {            DialogResult = DialogResult.OK;        }         private void m_cancelButton_Click(object sender, EventArgs e)        {            DialogResult = DialogResult.Cancel;        }         private void m_siteListButton_Click(object sender, EventArgs e)        {            if (!UserUtil.IsAdmin(GlobalManager.WebServices))            {                MessageBox.Show("This command can only be run by administrators");                return;            }             SiteList sitelist = SiteList.Load();             ConfigSiteListDialog dialog = new ConfigSiteListDialog(sitelist);             DialogResult result = dialog.ShowDialog();            if (result != DialogResult.OK)                return;             sitelist = dialog.SiteList;            sitelist.Save();        }         private void m_ComboBox_SelectedIndexChanged(object sender, EventArgs e)        {            ComboBox combo = sender as ComboBox;            SetDescriptionText(combo);        }         private void SetDescriptionText(ComboBox combo)        {            if (combo != null)            {                string value = combo.Text;                LinkFormat linkFormat = ConvertLinkFormat(value);                 if (linkFormat == LinkFormat.VaultExplorer)                {                    m_descriptionLabel.Text =                        "A link to an object inside Vault Explorer.  Following the " +                        "link will cause Vault Explorer to open and navigate to the " +                        "object.";                }                else if (linkFormat == LinkFormat.VaultPath)                {                    m_descriptionLabel.Text =                        "The full Vault path.  Technically this is not a link.";                }                else if (linkFormat == LinkFormat.WebClient)                {                    m_descriptionLabel.Text =                        "A link to a page inside the Vault web client.  Following " +                        "the link will cause the default web browser to navigate to " +                        "the object in the web browser." + Environment.NewLine +                        "NOTE: This will link to a specific version, so the link may go out of date over time.";                }                else                {                    m_descriptionLabel.Text = String.Empty;                }            }        }         private void m_ComboBox_Enter(object sender, EventArgs e)        {            ComboBox combo = sender as ComboBox;            SetDescriptionText(combo);        }    }}

Дмитрий Емельянов:
Евгений, вы можете сравнить ссылку, которую получаете при помощи своего кода, с ссылкой, которую можно получить из интерфейса Vault?
Есть два типа ссылок: URL и та, которая запускает клиент Vault с переходом к файлу.

Пашин Евгений:
Добрый день, Дмитрий.


--- Цитата: Дмитрий Емельянов от 30-05-2017, 15:44:15 ---Есть два типа ссылок: URL и та, которая запускает клиент Vault с переходом к файлу.
--- Конец цитаты ---
Мне нужен второй вариант - с переходом к файлу/папке.
И да, действительно содержание ссылок отличаются... Подправил!

Пашин Евгений:
Дмитрий, тут такое дело: при нажатии на ссылку происходит загрузка файла с расширением *.acr, при двойном нажатии на который происходит желанный переход в хранилище Vault к указанному файлу. ОДНАКО это не совсем тот эффект, который я пытаюсь достичь.

На самом деле хочется, чтобы вызов происходил при нажатии на ссылку внутри сообщения.

Может есть какое-нибудь решение, как это сделать (без скачивания *.acr-файла)?

Сама ссылка получается в таком виде:
http://vault01/AutodeskDM/Services/EntityDataCommandRequest.aspx?Vault=%D0%9A%D0%BE%D0%BD%D1%82%D0%B5%D0%BD%D1%82%D0%BD%D0%B0%D1%8F%20%D0%B1%D0%B0%D0%B7%D0%B0&ObjectId=%24%2f%D0%9F%D0%B0%D1%88%D0%B8%D0%BD+%D0%95%D0%B2%D0%B3%D0%B5%D0%BD%D0%B8%D0%B9+-+%D1%82%D0%B5%D1%81%D1%82%D0%B8%D1%80%D1%83%D0%B5%D0%BC+Email+Notification%2fReset+Parameters+in+AutoCAD+2017.bat&ObjectType=File&Command=Select

Сам *.acr-файл выглядит так:

--- Код - XML [Выбрать] ---<?xml version="1.0" encoding="utf-8"?><ADM xmlns="http://schemas.autodesk.com/msd/plm/ExplorerAutomation/2004-11-01">  <Server>vault01</Server>  <Vault>Контентная база</Vault>  <Operations>    <Operation ObjectType="File">      <ObjectID>$/Пашин Евгений - тестируем Email Notification/Reset Parameters in AutoCAD 2017.bat</ObjectID>      <Command>Select</Command>    </Operation>  </Operations></ADM>
И ещё, есть ли возможность получить ссылку на папку? А то я что-то её не увидел в Vault.

Дмитрий Емельянов:
Нет, можно только путём скачивания файла, так как приложением по-умолчанию (обработчиком расширения) для открытия таких файлов является Vault. Это особенность Windows. Возможно, ссылку можно получить для Vault Office (или тонкий клиент), который работает как раз через браузер.

На папку получить ссылку возможности не было (в 2014 версии, под которую я ещё писал). Сомневаюсь, что она появилась сейчас.

Навигация

[0] Главная страница сообщений

[#] Следующая страница

Перейти к полной версии