working on it ...

Filters

Explore Public Snippets

Sort by

Found 1,737 snippets matching: bulk

    public by skaggej  237899  1  6  0

    SharePoint 2010 - Bulk Upload Solution Packages

    When migrating a SharePoint environment from 2007 to 2010, don't forget about your solution packages! You can extract them from the SharePoint 2007 Solution Store, then use this script to upload them all to SharePoint 2010 in seconds!
    $solutions = Get-ChildItem -Path "C:\downloads\Exported Solution Packages"
    $solutions | ForEach-Object {add-spsolution -literalpath "C:\Exported Solution Packages\$_"}

    public by sherazam  182364  1  5  0

    How to Delete Messages in Bulk or One by One from Outlook PST in .NET Apps

    This technical tip explains how .NET developers can Delete Messages from outlook PST. Add Messages to PST Files showed how to add messages to PST files. It is, of course, also possible to delete items (contents) from a PST file and it may also be desirable to delete messages in bulk. Items from a PST file can be deleted using the FolderInfo.DeleteC
    // Enter here the actual content of the snippet.            
    //Deleting Messages from PST Files
    
    //The code snippets below delete messages from a PST file's Sent subfolder.
    
    //[C# Code Sample]
    
    // Get the Sent items folder
    FolderInfo folderInfo = pst.GetPredefinedFolder(StandardIpmFolder.SentItems);
    MessageInfoCollection msgInfoColl = folderInfo.GetContents();
    foreach (MessageInfo msgInfo in msgInfoColl)
    {
        Console.WriteLine(msgInfo.Subject + ": " + msgInfo.EntryIdString);
        if (msgInfo.Subject.Equals("some delete condition") == true)
        {
            // Delete this item
            folderInfo.DeleteChildItem(msgInfo.EntryId);
            Console.WriteLine("Deleted this message");
        }
    }
     
    //[VB.NET Code Sample]
    
    ' Get the Sent items folder
    Dim folderInfo As FolderInfo = pst.GetPredefinedFolder(StandardIpmFolder.SentItems)
    Dim msgInfoColl As MessageInfoCollection = folderInfo.GetContents()
    For Each msgInfo As MessageInfo In msgInfoColl
    	Console.WriteLine(msgInfo.Subject & ": " & msgInfo.EntryIdString)
    	If msgInfo.Subject.Equals("some delete condition") = True Then
    		' Delete this item
    		folderInfo.DeleteChildItem(msgInfo.EntryId)
    		Console.WriteLine("Deleted this message")
    	End If
    Next msgInfo
    
    //Delete Items in Bulk from PST File
    
    //Aspose.Email API can be used to delete items in bulk from a PST file. This is achieved using the DeleteChildItems method which accepts a list of Entry ID items referring to the items to be deleted.
    
    //[C# Code Sample]
    
    using (PersonalStorage pst = PersonalStorage.FromFile(@"test.pst"))
    {
        FolderInfo inbox = pst.RootFolder.GetSubFolder("Inbox");
        
        // find messages having From = "someuser@domain.com" 
        PersonalStorageQueryBuilder queryBuilder = new PersonalStorageQueryBuilder();
        queryBuilder.From.Contains("someuser@domain.com");
        MessageInfoCollection messages = inbox.GetContents(queryBuilder.GetQuery());
        IList<string> deleteList = new List<string>();
        foreach (MessageInfo messageInfo in messages)
        {
            deleteList.Add(messageInfo.EntryIdString);
        }
        
        // delete messages having From = "someuser@domain.com"
        inbox.DeleteChildItems(deleteList);
    }
    
    //[VB.NET Code Sample]
    
    Using pst As PersonalStorage = PersonalStorage.FromFile("test.pst")
    	Dim inbox As FolderInfo = pst.RootFolder.GetSubFolder("Inbox")
    
    	' find messages having From = "someuser@domain.com" 
    	Dim queryBuilder As New PersonalStorageQueryBuilder()
    	queryBuilder.From.Contains("someuser@domain.com")
    	Dim messages As MessageInfoCollection = inbox.GetContents(queryBuilder.GetQuery())
    	Dim deleteList As IList(Of String) = New List(Of String)()
    	For Each messageInfo As MessageInfo In messages
    		deleteList.Add(messageInfo.EntryIdString)
    	Next
    
    	' delete messages having From = "someuser@domain.com"
    	inbox.DeleteChildItems(deleteList)
    End Using
    
    

    public by cghersi  303  1  5  1

    Retrieve BLOB From Azure Blob Storage

    Quick method to retrieve a set of BLOBs for Azure Blob Storage, given their names. Unfortunately the Azure REST APIs don't allow, yet, to BULK retrieve the content of several BLOBs in one single call, so we need to loop over each BLOB and retrieve the content one by one
    public static Dictionary<Guid, byte[]> GetBlobs(List<string> names)
    {
      Dictionary<string, byte[]> result = new Dictionary<string, byte[]>();
    
      // retrieve info about the interesting BLOBs:
      IEnumerable<CloudBlob> blobs = s_defaultContainer.ListBlobs().
        OfType<CloudBlob>().Where(c => names.Contains(c.Name));
      
      // loop over the retrieved BLOBs:
      foreach (CloudBlob b in blobs)
      {
      	b.FetchAttributes(); //otherwise we cannot query for Properties...
      	byte[] res = new byte[b.Properties.Length];
      	
      	// download the actual content:
      	b.DownloadToByteArray(res, 0); 
      	
      	result.Add(b.Name, res);
      }
      
      return result;
    }

    public by paulsimmons  1081  0  5  0

    WooCommerce Variable Pricing Plugin by FMEAddons

    If you want to convert potential customers to successful business leads, then WooCommerce variable pricing extension is a powerful tool for achieving this goal. This addon provides you an easy interface to offer bulk discounts on various sections on your website. You can give a special offer to your customers such as buy three products and get one
    // Enter here the actual content of the snippet.            

    public by msdn  133122  0  6  0

    TraceGeneric: Generic tracing function that does the bulk of the legwork for our internal tracing. Every trace statement gets prepended by the function name.

    Generic tracing function that does the bulk of the legwork for our internal tracing. Every trace statement gets prepended by the function name. The fully qualified function name (preface) to the trace statement. Required trace category. Optional format string. Params that match the format string.
    using System;
    using System.Collections.Generic;
    using System.Globalization;
    using System.Linq;
    using System.Text;
    using System.Reflection;
    using System.Diagnostics;
    
    /// <summary>
    /// Allow caller to remove a standard prefix from some/all of the display method names.
    /// </summary>
    public static string MethodNameIgnorePrefix { get; set; }
    /// <summary>
    /// Accessor to the (thread) static string builder. We use this so we can JIT create
    /// the thread static instance.
    /// </summary>
    private static StringBuilder Builder
            {
                get
                {
                    if (m_builder == null)
                    {
                        m_builder = new StringBuilder();
                    }
                    return m_builder;
                }
            }
    /// <summary>
    /// When we have an error when attempting to build a trace statement we will instead
    /// trace a message using this category.
    /// </summary>
    private const string TraceErrorCategory = "TraceError";
    
    /// <summary>
    /// Generic tracing function that does the bulk of the legwork for our internal tracing.
    /// Every trace statement gets prepended by the function name.
    /// </summary>
    /// <param name="preface">The fully qualified function name (preface) to the trace
    /// statement.</param>
    /// <param name="category">Required trace category.</param>
    /// <param name="format">Optional format string.</param>
    /// <param name="args">Params that match the format string.</param>
    private static void TraceGeneric(string preface, string category, string format, params object[] args)
    {
        // check for standard prefix to be ignored
        if (MethodNameIgnorePrefix != null &&
            preface.StartsWith(MethodNameIgnorePrefix, StringComparison.OrdinalIgnoreCase))
        {
            // replace standard prefix with truncation indicator
            preface = @"+" + preface.Substring(MethodNameIgnorePrefix.Length);
        }
    
        try
        {
            if (null == format)
            {
                Trace.WriteLine(preface, category);
            }
            else
            {
                try
                {
                    StringBuilder builder = Builder;
    
                    builder.Remove(0, builder.Length);
                    builder.Append(preface);
                    builder.Append(" ");
                    builder.AppendFormat(CultureInfo.InvariantCulture, format, args);
    
                    Trace.WriteLine(builder.ToString(), category);
                }
                catch (ArgumentOutOfRangeException)
                {
                    Trace.WriteLine("Trace string too large", TraceErrorCategory);
                }
                catch (ArgumentNullException)
                {
                    Trace.WriteLine("Null arguments supplied for tracing", TraceErrorCategory);
                }
                catch (FormatException)
                {
                    Trace.WriteLine("Unable to format the supplied trace message", TraceErrorCategory);
                }
            }
        }
        catch
        {
            // Ignore all exceptions to trace. We don't want to propogate exception
            // up the call stack when tracing fails.
        }
    }

    public by msdn  156171  0  6  0

    CreateBulkIngestManifest

    // Create bulk ingest manifest
    using System;
    using System.Configuration;
    using System.Globalization;
    using System.IO;
    using System.Net;
    using System.Runtime.Serialization.Json;
    using System.Text;
    using System.Threading;
    using System.Threading.Tasks;
    using System.Web;
    using System.Xml;
    using System.Linq;
    using Microsoft.WindowsAzure;
    using Microsoft.WindowsAzure.MediaServices.Client;
    using Microsoft.WindowsAzure.Storage;
    using Microsoft.WindowsAzure.Storage.Blob;
    using Microsoft.WindowsAzure.Storage.Auth;
    using System.Collections.Generic;
    using System.Reflection;
    
    // Class-level field used to keep a reference to the service context.
    private static CloudMediaContext _context = null;
    private static readonly string _singleInputMp4Path =
                Path.GetFullPath(_supportFiles + @"\multifile\BigBuckBunny.mp4");
    private static readonly string _primaryFilePath =
                Path.GetFullPath(_supportFiles + @"\multifile\interview1.wmv");
    // Paths to support files (within the above base path). You can use 
    // the provided sample media files from the "supportFiles" folder, or 
    // provide paths to your own media files below to run these samples.
    private static readonly string _singleInputFilePath =
                Path.GetFullPath(_supportFiles + @"\multifile\interview2.wmv");
    
    // Create bulk ingest manifest
    static IIngestManifest CreateBulkIngestManifest(string name)
    {
        Console.WriteLine("\n===============================================");
        Console.WriteLine("========[ CREATE BULK INGEST MANIFEST ]========");
        Console.WriteLine("===============================================\n");
    
    
        IIngestManifest manifest = _context.IngestManifests.Create(name);
    
        IAsset destAsset1 = _context.Assets.Create(name + "_asset_1", AssetCreationOptions.None);
        IAsset destAsset2 = _context.Assets.Create(name + "_asset_2", AssetCreationOptions.None);
    
        string filename1 = _singleInputMp4Path;
        string filename2 = _primaryFilePath;
        string filename3 = _singleInputFilePath;
    
        //=== Preently, each asset filename uploaded must be unique for an individual Bulk ingest manifest. So two assets can not have ===//
        //=== the same asset filename or an exception will be thrown for duplicate filename.                                           ===//
        IIngestManifestAsset bulkAsset1 = manifest.IngestManifestAssets.Create(destAsset1, new[] { filename1 });
        IIngestManifestAsset bulkAsset2 = manifest.IngestManifestAssets.Create(destAsset2, new[] { filename2, filename3 });
    
        ListIngestManifests(manifest.Id);
    
        Console.WriteLine("\n===============================================");
        Console.WriteLine("===[ BULK INGEST MANIFEST MONITOR FILE COPY]===");
        Console.WriteLine("===============================================\n");
    
        UploadBlobFile(manifest.BlobStorageUriForUpload, filename1);
        UploadBlobFile(manifest.BlobStorageUriForUpload, filename2);
        UploadBlobFile(manifest.BlobStorageUriForUpload, filename3);
    
        MonitorBulkManifest(manifest.Id);
        ListIngestManifests(manifest.Id);
    
        return manifest;
    }

    public by msdn  1137  0  6  0

    BulkInsertTable

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using System.Activities.Presentation.Toolbox;
    using System.IO;
    using System.Net;
    using System.Web;
    using Microsoft.Web.Deployment;
    using System.Data;
    using System.Runtime.Serialization.Formatters.Binary;
    using System.Configuration;
    using System.Web.Configuration;
    using System.Xml.Linq;
    using System.Xml;
    using System.ServiceModel.Activities;
    using System.ServiceModel;
    using System.ComponentModel;
    
    private static void BulkInsertTable(DataTable sourceTable, System.Data.SqlClient.SqlBulkCopy sbc)
    {
        sbc.DestinationTableName = sourceTable.TableName;
        sbc.WriteToServer(sourceTable);
    }

    public by msdn  1451  2  6  0

    UploadFile

    // Using the URL returned by the GetBulkUploadUrl operation, // POST the bulk file using a HTTP client.
    using System;
    using System.Collections.Generic;
    using System.Globalization;
    using System.IO;
    using System.IO.Compression;
    using System.Linq;
    using System.Net;
    using System.ServiceModel;
    using System.Threading;
    using System.Threading.Tasks;
    using Microsoft.BingAds;
    using Microsoft.BingAds.Bulk;
    
    // Specify credentials if using PasswordAuthentication
    private const string UserName = "<UserNameGoesHere>";
    private const string Password = "<PasswordGoesHere>";
    
    // Using the URL returned by the GetBulkUploadUrl operation, 
    // POST the bulk file using a HTTP client. 
    private static void UploadFile(
        AuthorizationData authorizationData,
        string uploadUrl,
        string filePath)
    {
        var webClient = new WebClient();
    
        var authCodeGrantAuthentication = authorizationData.Authentication as OAuthDesktopMobileAuthCodeGrant;
        if (authCodeGrantAuthentication != null)
        {
            webClient.Headers.Add("AuthenticationToken", authCodeGrantAuthentication.OAuthTokens.AccessToken);
        }
        else
        {
            var implicitCodeGrantAuthentication = authorizationData.Authentication as OAuthDesktopMobileImplicitGrant;
            if (implicitCodeGrantAuthentication != null)
            {
                webClient.Headers.Add("AuthenticationToken", implicitCodeGrantAuthentication.OAuthTokens.AccessToken);
            }
            else
            {
                var passwordAuthentication =
                    authorizationData.Authentication as PasswordAuthentication;
                if (passwordAuthentication != null)
                {
                    // Global UserName and Password will be used.
                    webClient.Headers.Add("UserName", UserName);
                    webClient.Headers.Add("Password", Password);
                }
            }
        }
    
        webClient.Headers.Add("DeveloperToken", authorizationData.DeveloperToken);
        webClient.Headers.Add("CustomerId", authorizationData.CustomerId.ToString(CultureInfo.InvariantCulture));
        webClient.Headers.Add("CustomerAccountId", authorizationData.AccountId.ToString(CultureInfo.InvariantCulture));
    
        webClient.UploadFile(uploadUrl, filePath);
    }

    public by msdn  1425  0  5  0

    CompressFile

    // Compresses a bulk file to a ZIP Archive.
    using System;
    using System.Collections.Generic;
    using System.Globalization;
    using System.IO;
    using System.IO.Compression;
    using System.Linq;
    using System.Net;
    using System.ServiceModel;
    using System.Threading;
    using System.Threading.Tasks;
    using Microsoft.BingAds;
    using Microsoft.BingAds.Bulk;
    
    // Compresses a bulk file to a ZIP Archive.
    
    private static void CompressFile(string fromExtractedFile, string toZipArchive)
    {
        using (ZipArchive archive = ZipFile.Open(toZipArchive, ZipArchiveMode.Update))
        {
            if (fromExtractedFile != null)
            {
                archive.GetEntry(Path.GetFileName(fromExtractedFile)).Delete();
                archive.CreateEntryFromFile(fromExtractedFile, Path.GetFileName(fromExtractedFile));
            }
        }
    }

    public by msdn  1199  0  5  0

    DeleteBulkManifest

    // Delete bulk ingest manifest
    using System;
    using System.Configuration;
    using System.Globalization;
    using System.IO;
    using System.Net;
    using System.Runtime.Serialization.Json;
    using System.Text;
    using System.Threading;
    using System.Threading.Tasks;
    using System.Web;
    using System.Xml;
    using System.Linq;
    using Microsoft.WindowsAzure;
    using Microsoft.WindowsAzure.MediaServices.Client;
    using Microsoft.WindowsAzure.Storage;
    using Microsoft.WindowsAzure.Storage.Blob;
    using Microsoft.WindowsAzure.Storage.Auth;
    using System.Collections.Generic;
    using System.Reflection;
    
    // Class-level field used to keep a reference to the service context.
    private static CloudMediaContext _context = null;
    
    // Delete bulk ingest manifest
    static void DeleteBulkManifest(string name)
    {
        Console.WriteLine("\n===============================================");
        Console.WriteLine("=======[ DELETE BULK INGEST MANIFESTS ]========");
        Console.WriteLine("===============================================\n");
    
        foreach (IIngestManifest manifest in _context.IngestManifests.Where(c => c.Name == name))
        {
            DeleteBulkManifestAssets(manifest.Id);
    
            Console.WriteLine("Deleting Manifest...\n\tName : {0}\n\tManifest ID : {1}...", manifest.Name, manifest.Id);
            manifest.Delete();
            Console.WriteLine("Delete Complete.\n");
        }
    }
    • Public Snippets
    • Channels Snippets