Esempio n. 1
0
        /// <summary>
        /// Registers a package with the SharePointLibraryPackageStore. Any changes to the original file after the package is
        /// registered are not reflected in the store.
        /// </summary>
        /// <param name="packageReader">A reader positioned on the package.</param>
        /// <param name="packageEnforcement">The settings to determine whether the package should be modified to
        /// allow it to be added to the store.</param>
        /// <returns>The results of adding the package, including a log of any warnings or errors that occurred in the process.
        /// </returns>
        /// <exception cref="PackageImportException">Thrown if the package could not be registered with the store. The exception may
        /// include a log indicating a cause for the failure.</exception>
        /// <remarks>The package is read from SharePoint under elevated privileges. The current user does not need access to the
        /// package in order to register it. However, the current user does need to have permission to add a package to
        /// LearningStore in order to register it.</remarks>
        public RegisterPackageResult RegisterPackage(FileSystemBasedSharePointPackageReader packageReader, PackageEnforcement packageEnforcement)
        {
            Utilities.ValidateParameterNonNull("packageEnforcement", packageEnforcement);
            Utilities.ValidateParameterNonNull("packageReader", packageReader);

            // Add the reference to the package. The process of importing the package will cause the package reader to cache
            // the package in the file system.
            AddPackageReferenceResult refResult = AddPackageReference(packageReader, packageReader.Location.ToString(), packageEnforcement);

            return(new RegisterPackageResult(refResult));
        }
Esempio n. 2
0
 /// <summary>
 /// Create an AddPackageResult from the results of adding a reference to a package in PackageStore.
 /// </summary>
 /// <param name="addReferenceResult">The results of adding a package reference to PackageStore.</param>
 internal AddPackageResult(AddPackageReferenceResult addReferenceResult)
 {
     m_log       = addReferenceResult.Log;
     m_packageId = addReferenceResult.PackageId;
 }