private static ResourceInfo GetResourceInfoFromPropertyRow(WebDavStorageElementPropertiesRow propertyRow)
        {
            if (propertyRow == null)
            {
                throw new ArgumentNullException("propertyRow");
            }
            ResourceInfo          retVal  = null;
            WebDavAbstractFactory factory = new WebDavAbstractFactory();

            //For MetaData stored int hash for Guid value is not possible restore back from hash to Guid
            if ((ObjectTypes)propertyRow.ObjectTypeId != ObjectTypes.File_MetaData)
            {
                WebDavElementStorageProvider provider = factory.Create <WebDavElementStorageProvider>(propertyRow.ObjectTypeId);
                WebDavAbsolutePath           absPath  = WebDavAbsolutePath.CreateInstance((ObjectTypes)propertyRow.ObjectTypeId);
                absPath.UniqueId = propertyRow.ObjectId;
                absPath.FileName = "file";
                WebDavTicket ticket = WebDavTicket.CreateInstance(ePluginToken.webdav, Guid.Empty, absPath);
                try
                {
                    retVal = provider.GetElementInfo(ticket.ToString()) as ResourceInfo;
                }
                catch (Exception)
                {
                }
            }
            return(retVal);
        }
Beispiel #2
0
        public static string GetFileStorageWebDavUrl(int fileId, int historyId, string fileName, bool withAuthToken, Uri baseUri)
        {
            FileStorageAbsolutePath absPath = (FileStorageAbsolutePath)WebDavAbsolutePath.CreateInstance(ObjectTypes.File_FileStorage);

            absPath.UniqueId  = fileId;
            absPath.FileName  = fileName;
            absPath.HistoryId = historyId;
            //Do not allow server edit for history file versions
            return(GetWebDavUrl(absPath, withAuthToken, historyId == -1, baseUri));
        }
Beispiel #3
0
        /// <summary>
        /// Gets the web dav URL.
        /// </summary>
        /// <param name="fileInfo">The file info.</param>
        /// <param name="withAuthToken">if set to <c>true</c> [with auth token].</param>
        /// <returns></returns>
        public static string GetMetaDataWebDavUrl(Mediachase.Ibn.Data.Meta.FileInfo fileInfo, bool withAuthToken)
        {
            if (fileInfo == null)
            {
                throw new ArgumentNullException("fileInfo");
            }

            MetaDataAbsolutePath absPath = (MetaDataAbsolutePath)WebDavAbsolutePath.CreateInstance(ObjectTypes.File_MetaData);

            absPath.FileUID  = fileInfo.FileUID;
            absPath.FileName = fileInfo.Name;

            return(GetWebDavUrl(absPath, withAuthToken));
        }
Beispiel #4
0
        /// <summary>
        /// Gets the web dav URL.
        /// </summary>
        /// <param name="emailId">The email id.</param>
        /// <param name="emailAttachIndex">Index of the email attach.</param>
        /// <param name="withAuthToken">if set to <c>true</c> [with auth token].</param>
        /// <returns></returns>
        public static string GetEmailAtachWebDavUrl(int emailId, int emailAttachIndex, bool withAuthToken)
        {
            EMailMessageInfo emlInfo = EMailMessageInfo.Load(emailId);

            if (emlInfo.Attachments.Length <= emailAttachIndex)
            {
                throw new ArgumentException("emailAttachIndex");
            }

            AttachmentInfo attachInfo = emlInfo.Attachments[emailAttachIndex];

            EmailStorageAbsolutePath absPath = (EmailStorageAbsolutePath)WebDavAbsolutePath.CreateInstance(ObjectTypes.File_Incident);

            absPath.EmailMsgId           = emailId;
            absPath.EmailAttachmentIndex = emailAttachIndex;
            absPath.FileName             = attachInfo.FileName;

            return(GetWebDavUrl(absPath, withAuthToken));
        }
Beispiel #5
0
        /// <summary>
        /// Gets the web dav URL.
        /// </summary>
        /// <param name="metaObjectId">The meta object id.</param>
        /// <param name="metaClassName">Name of the meta class.</param>
        /// <param name="metaFieldName">Name of the meta field.</param>
        /// <param name="withAuthToken">if set to <c>true</c> [with auth token].</param>
        /// <returns></returns>
        public static string GetMetaDataPlusWebDavUrl(Mediachase.MetaDataPlus.MetaObject mo, string metaField, bool withAuthToken)
        {
            MetaFile mf = mo[metaField] as MetaFile;

            if (mf == null)
            {
                throw new ArgumentException(metaField + " is not a MetaFile");
            }

            MetaDataPlusAbsolutePath absPath = (MetaDataPlusAbsolutePath)WebDavAbsolutePath.CreateInstance(ObjectTypes.File_MetaDataPlus);

            absPath.MetaFieldName  = metaField;
            absPath.MetaObjectId   = mo.Id;
            absPath.MetaObjectType = mo.MetaClass.Name;
            absPath.UniqueId       = mo.Id;
            absPath.FileName       = mf.Name;

            return(GetWebDavUrl(absPath, withAuthToken));
        }