TestManagementHttpClient Create Test Run - tfs

I am trying below C# code to create TFS test run. But every time I am getting below error. Though I have given test plan details. I couldnt even find documentations on this.
Error
An exception of type 'Microsoft.TeamFoundation.TestManagement.WebApi.TestObjectNotFoundException' occurred in mscorlib.dll but was not handled in user code
Additional information: Test plan {0} not found.
Code
public async Task CreateTestRun()
{
TestManagementHttpClient witClient = connection.GetClient<TestManagementHttpClient>();
TestCaseResultUpdateModel TestCaseResultUpdateModel = new TestCaseResultUpdateModel();
ShallowReference testPlanReference = new ShallowReference();
testPlanReference.Id = "{TestPlanId}";
testPlanReference.Name = "{TestPlanName}";
testPlanReference.Url = "http://{TFSInstance}/{Project}/_apis/test/plans/{TestPlanID}";
RunCreateModel RunCreateModel = new RunCreateModel("SWAT-Run","",new int[] {2304187},testPlanReference,
null,0,"",false,"Error Message","","","","","comment","","", "",
null, null, null, null,null,"","","","",new TimeSpan(0,0,10,0,0),"",null);
TestRun testRun = await witClient.CreateTestRunAsync(this.Project, RunCreateModel, null);
}

I have done it succssful with below code, hope it can be helpful to you.
var tfsRun = _testPoint.Plan.CreateTestRun(false);
tfsRun.DateStarted = DateTime.Now;
tfsRun.AddTestPoint(_testPoint, _currentIdentity);
tfsRun.DateCompleted = DateTime.Now;
tfsRun.Save(); // so results object is created
var result = tfsRun.QueryResults()[0];
result.Owner = _currentIdentity;
result.RunBy = _currentIdentity;
result.State = TestResultState.Completed;
result.DateStarted = DateTime.Now;
result.Duration = new TimeSpan(0L);
result.DateCompleted = DateTime.Now.AddMinutes(0.0);
var iteration = result.CreateIteration(1);
iteration.DateStarted = DateTime.Now;
iteration.DateCompleted = DateTime.Now;
iteration.Duration = new TimeSpan(0L);
iteration.Comment = "Run from TFS Test Steps Editor by " + _currentIdentity.DisplayName;
for (int actionIndex = 0; actionIndex < _testEditInfo.TestCase.Actions.Count; actionIndex++)
{
var testAction = _testEditInfo.TestCase.Actions[actionIndex];
if (testAction is ISharedStepReference)
continue;
var userStep = _testEditInfo.SimpleSteps[actionIndex];
var stepResult = iteration.CreateStepResult(testAction.Id);
stepResult.ErrorMessage = String.Empty;
stepResult.Outcome = userStep.Outcome;
foreach (var attachmentPath in userStep.AttachmentPaths)
{
var attachment = stepResult.CreateAttachment(attachmentPath);
stepResult.Attachments.Add(attachment);
}
iteration.Actions.Add(stepResult);
}
var overallOutcome = _testEditInfo.SimpleSteps.Any(s => s.Outcome != TestOutcome.Passed)
? TestOutcome.Failed
: TestOutcome.Passed;
iteration.Outcome = overallOutcome;
result.Iterations.Add(iteration);
result.Outcome = overallOutcome;
result.Save(false);

Related

TFS API: How to get attachments from shared steps?

This is what I see in the test results in the Test Manager: some attachments (1) are on the test steps (in this case - on a shared step). Some (2) are on a result level. In the report I'm working on, I can extract information about attachments (2), but fail to get information about (1). Any suggestions?
In the debugger I can see, that the steps are iterated, I can see, i.e. "Verify the stuff" string etc, but the step has 0 attachments.
For reference, this is most of the code I am using to extract test case results:
foreach (ITestCaseResult testCaseResult in resutlsToDisplay)
{
project.TestCases.Find(test.Id);
var testRun = testCaseResult.GetTestRun();
var testPlanEntry = project.TestPlans.Find(testRun.TestPlanId);
var artifacts = testCaseResult.QueryAssociatedWorkItemArtifacts();
if (testPlanEntry.Name != testPlan)
continue;
var testResult = new TestResult // CUSTOM CLASS
{
TestConfiguration = testCaseResult.TestConfigurationName,
TestRun = testRun.Id,
DateCreated = testRun.DateCreated,
DateStarted = testRun.DateStarted,
DateCompleted = testRun.DateCompleted,
Result = testCaseResult.Outcome.ToString(),
TestResultComment = testRun.Comment,
RunBy = testCaseResult.RunBy == null ? "" : testCaseResult.RunBy.DisplayName,
Build = testRun.BuildNumber ?? ""
};
foreach (var iteration in testCaseResult.Iterations)
{
var iterationResult = testResult.Clone();
iterationResult.ResultAttachmentHtml = getAttachments(iteration.Attachments, testCase.TestCaseId.ToString(), string.Empty, iteration.IterationId.ToString()); // HERE I GET THE ATTACHMENTS OF TYPE 2
iterationResult.Iteration = iteration.IterationId;
iterationResult.IterationComment = iteration.Comment;
foreach (var step in steps)
{
var stepCopy = step.Clone();
iterationResult.Steps.Add(stepCopy);
var actionResult = iteration.FindActionResult(stepCopy.TestStep);
if (actionResult == null)
continue;
stepCopy.Result.Comment = actionResult.ErrorMessage;
stepCopy.Result.Result = actionResult.Outcome.ToString();
stepCopy.Result.AttachmentHtml = getAttachments(actionResult.Attachments, testCase.TestCaseId.ToString(), step.Number, iteration.IterationId.ToString()); // HERE I DO NOT GET ATTACHMENTS OF TYPE 1 - WHY?
}
config.TestCaseResult.TestResults.Add(iterationResult);
}
} //end foreach testCaseResult in resutlsToDisplay
I think I figured it out eventually.
The ITestCaseResult contains ITestIterationResultCollection Iterations.
The ITestIterationResult contains TestActionResultCollection of ITestActionResult.
ITestActionResult can be either ITestStepResult or ISharedStepResult.
If it is ITestStepResult, then it has Attachments collection right there.
If it is ISharedStepResult, however, then it has its own TestActionResultCollection. So this is the one that I have to iterate to find if each member has Attachments.
The code to iterate over steps, including shared steps, looks like this:
foreach (ITestIterationResult iteration in testCaseResult.Iterations)
{
var iterationResult = testResult.Clone();
iterationResult.ResultAttachmentHtml = getAttachments(iteration.Attachments,
testCase.TestCaseId.ToString(),
string.Empty, iteration.IterationId.ToString());
iterationResult.Iteration = iteration.IterationId;
iterationResult.IterationComment = iteration.Comment;
foreach (ITestActionResult action in iteration.Actions)
{
if (action is ITestStepResult)
{
GetStepResults(steps, action, iterationResult, iteration, getAttachments, testCase, false);
}
else if (action is ISharedStepResult)
{
ISharedStepResult result = action as ISharedStepResult;
foreach (var sharedAction in result.Actions)
{
if (sharedAction is ITestStepResult)
{
GetStepResults(steps, sharedAction, iterationResult, iteration, getAttachments, testCase, true);
}
}
}
}

templateService.Parse not able to parese Tuple used in view(MVC)

I am trying to parse a .cshtml with tuple and tuple used for acces two models in the view same time, but it is not working throwing error, but if I am using only one model than same this is wotking.
Here is my code:
Controller:
var deviceModel = new DevicesInformationDataViewModel { };
var eventModel = new EventsInformationDataViewModel{ };
var templateFolderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Views\\EmailTemplates");
var emailTemplatePath = Path.Combine(templateFolderPath, "EmailTemplates.cshtml");
var templateService = new TemplateService();
var emailHtmlBody = "";
string email = data[1];
ViewBag.info = data[0];
if (data[0] == "DeviceInfo")
{
deviceModel.Address = data[2];
deviceModel.Description = data[3];
deviceModel.eDescription = data[4];
deviceModel.Fault = data[5];
deviceModel.Type = data[6];
deviceModel.TypeCode = Int32.Parse(data[7]);
deviceModel.DriftCompensation = Int32.Parse(data[8]);
deviceModel.AlarmSensitivity = data[9];
deviceModel.Status = data[10];
emailHtmlBody = templateService.Parse(System.IO.File.ReadAllText(emailTemplatePath), deviceModel, ViewBag.info, null);
}
View:
If using like this, not working:
#model Tuple<DevicesInformationDataViewModel,EventsInformationDataViewModel>
but if using like this, it is working:
#model DevicesInformationDataViewModel
Can any body tell me what I am doing wrong and please tell me how can I resolve
this issue?

How to speed up ASP.NET MVC Excel file upload data validation against a stored procedure

I have an ASP.NET MVC application that uploads an Excel file with items that need to be validated against a stored procedure. This process works well if the Excel file has a few records, but now if I have more than over a hundred lines, it's very slow to validate.
Is there a way I can speed up his process somehow? Basically I write the data from the Excel file to a SQL Server database where I validate the data against a stored procedure. When I have about 50 records, it executes faster, as soon as I have over 100, it's very slow. Please see my code below and advise.
public ActionResult ValidateClaims()
{
var domainNameOfficial = Session["domainName"];
int sessionIdentifier = (int)Session["sessionID"];
var claimsRecords = db.CleanSupplierClaims.Where(x => x.CleanSupplierClaimsUploadSessionID == sessionIdentifier).ToList();
List<CleanSupplierClaim> supplierClaimsData = claimsRecords; //(List<CleanSupplierClaim>)TempData["supplierClaimsData"]; //= new List<CleanSupplierClaim>();// = claimsRecords;// My issue is here, I get all records and not the ones the user just uploaded
CleanSupplierClaimData supplierClaimUplaod = new CleanSupplierClaimData();
var sqlConnection = "data source=XXXXX;initial catalog=Embrace; User ID=XXXXX; Password=XXXXXXXX;";
using (SqlConnection conn = new SqlConnection(sqlConnection))
{
try
{
foreach (var claim in supplierClaimsData)
{
SqlCommand cmd = new SqlCommand();
cmd.CommandTimeout = 60;
cmd.CommandText = "CRM.Supplier_Claim_Upload";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("#Invoice", SqlDbType.NVarChar).Value = claim.Line_Number;
cmd.Parameters.Add("#Amount", SqlDbType.Decimal).Value = claim.Total_Claim;
cmd.Connection = conn;
conn.Open();
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
claim.ST_Key = reader.GetString(reader.GetOrdinal("ST_Key"));
claim.Error_1 = reader.GetString(reader.GetOrdinal("Error1"));
string lineNumberDoesNotExist = "Error: Invoice line number does not exist";
if (claim.Error_1.StartsWith(lineNumberDoesNotExist))
{
continue;
}
claim.Warning = reader.GetString(reader.GetOrdinal("Warning"));
claim.Error_2 = reader.GetString(reader.GetOrdinal("Error2"));
string warningCleanInclusion = "Warning";
if (claim.ST_Key != null && string.IsNullOrEmpty(claim.Warning) && string.IsNullOrEmpty(claim.Error_1) && string.IsNullOrEmpty(claim.Error_2))
{
var existingClaimCount = db.GPClaimsReadyToImports.Count(a => a.ST_Key == claim.ST_Key && a.CleanSupplierClaimSessionID == claim.CleanSupplierClaimsUploadSessionID);
if (existingClaimCount == 0)
db.GPClaimsReadyToImports.Add(new GPClaimsReadyToImport
{
Id = claim.Id,
ST_Key = claim.ST_Key,
Warning = claim.Warning,
Action = claim.Action,
Claim_Reference = claim.ClaimReference,
Currency = claim.Currency,
Error_1 = claim.Error_1,
Error_2 = claim.Error_2,
Line_Number = claim.Line_Number,
Total_Claim = claim.Total_Claim,
Domain_Username = domainNameOfficial.ToString(),//claim.Domain_Username,
DateCreated = DateTime.Now,
ImportFlag = true,
ReadyForImport = true,
CleanSupplierClaimSessionID = sessionIdentifier
});
db.SaveChanges();
}
}
foreach (CleanSupplierClaim saveToDBClaim in supplierClaimsData)
{
db.CleanSupplierClaims.Attach(saveToDBClaim);
var entry = db.Entry(saveToDBClaim);
entry.Property(aa => aa.Line_Number).IsModified = true;
entry.Property(aa => aa.Total_Claim).IsModified = true;
entry.Property(aa => aa.Currency).IsModified = true;
entry.Property(aa => aa.ClaimReference).IsModified = true;
entry.Property(aa => aa.Action).IsModified = true;
entry.Property(aa => aa.Domain_Username).IsModified = true;
entry.Property(aa => aa.Error_1).IsModified = true;
entry.Property(aa => aa.Error_2).IsModified = true;
entry.Property(aa => aa.Warning).IsModified = true;
entry.Property(aa => aa.ImportFlag).IsModified = true;
entry.Property(aa => aa.ReadyForImport).IsModified = true;
db.Entry(saveToDBClaim).State = System.Data.Entity.EntityState.Modified;
db.SaveChanges();
}
conn.Close();
}
}
catch (Exception ex)
{
ViewBag.Error = ex.Message + ex.InnerException;
}
var warningCount = "Warning";
var errorOneCont = "Error";
var errorTwo = "ErrorTwo";
var countWarning = supplierClaimsData.Select(x => x.Warning).Count();
var countErrorOne = supplierClaimsData.Select(x => x.Error_1).Count();
var countErrorTwo = supplierClaimsData.Select(x => x.Error_2).Count();
var officialWarning = String.Concat("Warning", countWarning);
ViewBag.WarningCount = officialWarning;
ViewBag.ErrorOneCount = countErrorOne;
ViewBag.ErrorTwoCount = countErrorTwo;
Session["supplierClaimsData"] = supplierClaimsData;
return View("ValidateClaims", supplierClaimsData);
}
}
I would recomend to use EPPLUS Plugin, available of NuGet.
https://www.nuget.org/packages/EPPlus/
I had used it for my large excel and its working perfect and speedy and OLEDB is not required at Runtime.
You can find a quick tutorial here :
http://zeeshanumardotnet.blogspot.com/2011/06/creating-reports-in-excel-2007-using.html

how to validate that a name entered using mvc doesn't exist in database

i am using sql server which is case sensitive. How can i convert the data so that it may be validated without being case sensitive
CODE:-
using (var kk = new TeamRepository(context))
{
var data = new Team();
var find = kk.GetAll().ToString();
if (find.Any(x => x.TeamName == apview.TeamName))
{
return false;
}
else
{
var _pointrepo = new PointsRepositotry(context);
if (image != null)
{
apview.ImageMimeType = image.ContentType;
apview.TeamLogo = new byte[image.ContentLength];
image.InputStream.Read(apview.TeamLogo, 0, image.ContentLength);
}
data.TeamLogo = apview.TeamLogo;
data.TeamName = apview.TeamName;
data.TeamEmail = apview.TeamEmail;
data.Contact_Number = apview.ContactNumber;
data.TeamNickName = apview.TeamNickName;
data.YearEstablished = apview.YearEstablished;
var points = new Points();
points.TeamName = apview.TeamName;
data.ImageMimeType = apview.ImageMimeType;
return kk.Insert(data);
//_pointrepo.Insert(points);
}
you can use ToLower
find.Any(x => x.TeamName.ToLower() == apview.TeamName.ToLower())
https://msdn.microsoft.com/en-us/library/e78f86at%28v=vs.110%29.aspx

Open XML SDK - image not showing in excel

I'm able to successfully create a spreadsheet, and I appear to have added the image via code, the problem is that when I open the spreadsheet, there is no image. Here is my code:
public static void CreateSpreadsheetWorkbook(string filepath)
{
SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.Create(filepath, SpreadsheetDocumentType.Workbook);
WorkbookPart workbookpart = spreadsheetDocument.AddWorkbookPart();
workbookpart.Workbook = new Workbook();
WorksheetPart worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
worksheetPart.Worksheet = new Worksheet(new SheetData());
Sheets sheets = spreadsheetDocument.WorkbookPart.Workbook.AppendChild<Sheets>(new Sheets());
Sheet sheet = new Sheet() { Id = spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart), SheetId = 1, Name = "mySheet" };
sheets.Append(sheet);
string sImagePath = #"C:\temp\install_button.png";
DrawingsPart drawingsPart = worksheetPart.AddNewPart<DrawingsPart>();
ImagePart imagePart = drawingsPart.AddImagePart(ImagePartType.Png, worksheetPart.GetIdOfPart(drawingsPart));
using (FileStream stream = new FileStream(sImagePath, FileMode.Open))
{
imagePart.FeedData(stream);
}
workbookpart.Workbook.Save();
spreadsheetDocument.Close();
}
Thanks
Stu
Normally when I can't figure out why something doesn't work when dealing with the Open XML SDK I use the Open XML SDK 2.0 Productivity Tool to figure out what the code should be. I will normally create a blank worksheet in Excel, add a picture and then save the document. Then I will open that document in the Productivity tool and click the Reflect code button to see how to recreate that document. I did that to see how to answer your question and got the following code to create a worksheet part:
// Adds child parts and generates content of the specified part.
public void CreateWorksheetPart(WorksheetPart part)
{
DrawingsPart drawingsPart1 = part.AddNewPart<DrawingsPart>("rId2");
GenerateDrawingsPart1Content(drawingsPart1);
ImagePart imagePart1 = drawingsPart1.AddNewPart<ImagePart>("image/png", "rId1");
GenerateImagePart1Content(imagePart1);
SpreadsheetPrinterSettingsPart spreadsheetPrinterSettingsPart1 = part.AddNewPart<SpreadsheetPrinterSettingsPart>("rId1");
GenerateSpreadsheetPrinterSettingsPart1Content(spreadsheetPrinterSettingsPart1);
GeneratePartContent(part);
}
// Generates content of drawingsPart1.
private void GenerateDrawingsPart1Content(DrawingsPart drawingsPart1)
{
Xdr.WorksheetDrawing worksheetDrawing1 = new Xdr.WorksheetDrawing();
worksheetDrawing1.AddNamespaceDeclaration("xdr", "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
worksheetDrawing1.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");
Xdr.TwoCellAnchor twoCellAnchor1 = new Xdr.TwoCellAnchor(){ EditAs = Xdr.EditAsValues.OneCell };
Xdr.FromMarker fromMarker1 = new Xdr.FromMarker();
Xdr.ColumnId columnId1 = new Xdr.ColumnId();
columnId1.Text = "0";
Xdr.ColumnOffset columnOffset1 = new Xdr.ColumnOffset();
columnOffset1.Text = "0";
Xdr.RowId rowId1 = new Xdr.RowId();
rowId1.Text = "0";
Xdr.RowOffset rowOffset1 = new Xdr.RowOffset();
rowOffset1.Text = "0";
fromMarker1.Append(columnId1);
fromMarker1.Append(columnOffset1);
fromMarker1.Append(rowId1);
fromMarker1.Append(rowOffset1);
Xdr.ToMarker toMarker1 = new Xdr.ToMarker();
Xdr.ColumnId columnId2 = new Xdr.ColumnId();
columnId2.Text = "0";
Xdr.ColumnOffset columnOffset2 = new Xdr.ColumnOffset();
columnOffset2.Text = "171429";
Xdr.RowId rowId2 = new Xdr.RowId();
rowId2.Text = "0";
Xdr.RowOffset rowOffset2 = new Xdr.RowOffset();
rowOffset2.Text = "171429";
toMarker1.Append(columnId2);
toMarker1.Append(columnOffset2);
toMarker1.Append(rowId2);
toMarker1.Append(rowOffset2);
Xdr.Picture picture1 = new Xdr.Picture();
Xdr.NonVisualPictureProperties nonVisualPictureProperties1 = new Xdr.NonVisualPictureProperties();
Xdr.NonVisualDrawingProperties nonVisualDrawingProperties1 = new Xdr.NonVisualDrawingProperties(){ Id = (UInt32Value)2U, Name = "Picture 1", Description = "eprs_reports_arrow.png" };
Xdr.NonVisualPictureDrawingProperties nonVisualPictureDrawingProperties1 = new Xdr.NonVisualPictureDrawingProperties();
A.PictureLocks pictureLocks1 = new A.PictureLocks(){ NoChangeAspect = true };
nonVisualPictureDrawingProperties1.Append(pictureLocks1);
nonVisualPictureProperties1.Append(nonVisualDrawingProperties1);
nonVisualPictureProperties1.Append(nonVisualPictureDrawingProperties1);
Xdr.BlipFill blipFill1 = new Xdr.BlipFill();
A.Blip blip1 = new A.Blip(){ Embed = "rId1", CompressionState = A.BlipCompressionValues.Print };
blip1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
A.Stretch stretch1 = new A.Stretch();
A.FillRectangle fillRectangle1 = new A.FillRectangle();
stretch1.Append(fillRectangle1);
blipFill1.Append(blip1);
blipFill1.Append(stretch1);
Xdr.ShapeProperties shapeProperties1 = new Xdr.ShapeProperties();
A.Transform2D transform2D1 = new A.Transform2D();
A.Offset offset1 = new A.Offset(){ X = 0L, Y = 0L };
A.Extents extents1 = new A.Extents(){ Cx = 171429L, Cy = 171429L };
transform2D1.Append(offset1);
transform2D1.Append(extents1);
A.PresetGeometry presetGeometry1 = new A.PresetGeometry(){ Preset = A.ShapeTypeValues.Rectangle };
A.AdjustValueList adjustValueList1 = new A.AdjustValueList();
presetGeometry1.Append(adjustValueList1);
shapeProperties1.Append(transform2D1);
shapeProperties1.Append(presetGeometry1);
picture1.Append(nonVisualPictureProperties1);
picture1.Append(blipFill1);
picture1.Append(shapeProperties1);
Xdr.ClientData clientData1 = new Xdr.ClientData();
twoCellAnchor1.Append(fromMarker1);
twoCellAnchor1.Append(toMarker1);
twoCellAnchor1.Append(picture1);
twoCellAnchor1.Append(clientData1);
worksheetDrawing1.Append(twoCellAnchor1);
drawingsPart1.WorksheetDrawing = worksheetDrawing1;
}
// Generates content of imagePart1.
private void GenerateImagePart1Content(ImagePart imagePart1)
{
System.IO.Stream data = GetBinaryDataStream(imagePart1Data);
imagePart1.FeedData(data);
data.Close();
}
// Generates content of spreadsheetPrinterSettingsPart1.
private void GenerateSpreadsheetPrinterSettingsPart1Content(SpreadsheetPrinterSettingsPart spreadsheetPrinterSettingsPart1)
{
System.IO.Stream data = GetBinaryDataStream(spreadsheetPrinterSettingsPart1Data);
spreadsheetPrinterSettingsPart1.FeedData(data);
data.Close();
}
// Generates content of part.
private void GeneratePartContent(WorksheetPart part)
{
Worksheet worksheet1 = new Worksheet();
worksheet1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
SheetDimension sheetDimension1 = new SheetDimension(){ Reference = "A1" };
SheetViews sheetViews1 = new SheetViews();
SheetView sheetView1 = new SheetView(){ TabSelected = true, WorkbookViewId = (UInt32Value)0U };
sheetViews1.Append(sheetView1);
SheetFormatProperties sheetFormatProperties1 = new SheetFormatProperties(){ DefaultRowHeight = 15D };
SheetData sheetData1 = new SheetData();
PageMargins pageMargins1 = new PageMargins(){ Left = 0.7D, Right = 0.7D, Top = 0.75D, Bottom = 0.75D, Header = 0.3D, Footer = 0.3D };
PageSetup pageSetup1 = new PageSetup(){ Orientation = OrientationValues.Portrait, Id = "rId1" };
Drawing drawing1 = new Drawing(){ Id = "rId2" };
worksheet1.Append(sheetDimension1);
worksheet1.Append(sheetViews1);
worksheet1.Append(sheetFormatProperties1);
worksheet1.Append(sheetData1);
worksheet1.Append(pageMargins1);
worksheet1.Append(pageSetup1);
worksheet1.Append(drawing1);
part.Worksheet = worksheet1;
}
#region Binary Data
private string imagePart1Data ="lots of binary data here";
private System.IO.Stream GetBinaryDataStream(string base64String)
{
return new System.IO.MemoryStream(System.Convert.FromBase64String(base64String));
}
#endregion
I recommend you do the same with your image and play around with the generated code in order to get it to work since as you can see just adding one picture to a new slide is a lot of code.

Resources