send the VSTS 2008 test results by email - testing

Can I send the VSTS 2008 test results by email automatically after test run?

Here you can download "Email Reporter: VSTS 2008 Load Test Plug-in" http://code.msdn.microsoft.com/erep
It's a very helpful post by Mohammad Ashraful Alam.

you can send email with notification and report attached. I guess, you can you can create stored procedure and run them at the end of the test execution for gathering required data. After that you can create .xml or Excel file with result of created procedure and attached it to email. So, you need to create load test plug-in:
namespace LoadTestPluginTest
{
public class MyLoadTestPlugin : ILoadTestPlugin
{
LoadTest myLoadTest;
public void Initialize(LoadTest loadTest)
{
myLoadTest = loadTest;
myLoadTest.LoadTestFinished += new
EventHandler(myLoadTest_LoadTestFinished);
}
void myLoadTest_LoadTestFinished(object sender, EventArgs e)
{
try
{
// place custom code here
MailAddress MyAddress = new MailAddress("someone#example.com");
MailMessage MyMail = new MailMessage(MyAddress, MyAddress);
MyMail.Subject = "Load Test Finished -- Admin Email";
MyMail.Body = ((LoadTest)sender).Name + " has finished.";
SmtpClient MySmtpClient = new SmtpClient("localhost");
MySmtpClient.Send(MyMail);
}
catch (SmtpException ex)
{
MessageBox.Show(ex.InnerException.Message +
".\r\nMake sure you have a valid SMTP.", "LoadTestPlugin");
}
}
}
}
Here is the description of LoadTest DB tables http://blogs.msdn.com/billbar/articles/529874.aspx

Related

skype for business automation to outlook

I have to add a feature in Skype for Business to open automatically a new Outlook task window when a call starts, with the phone number of the called/calling contact in the subject field. Is there any addin or api in order to do this?
Thank you
With the help of Lync SDK 2013, new conversation added event can be handled where you can also get participant related information. Inside conversation added event handler listen for AVModality state changes. When AVModality state is changed to connected, using Microsoft.Office.Interop.Outlook outlook application can be automated and new task window can be created as given below
LyncClient lyncClient = new LyncClient();
lyncClient.ConversationManager.ConversationAdded += OnConversationAdded;
private void OnConversationAdded(object sender, Microsoft.Lync.Model.Conversation.ConversationManagerEventArgs e)
{
e.Conversation.Modalities[ModalityTypes.AudioVideo].ModalityStateChanged += OnAudioVideoModalityStateChanged;
}
private void OnAudioVideoModalityStateChanged(object sender, ModalityStateChangedEventArgs e)
{
switch(e.NewState)
{
case ModalityState.Connected:
Application oOutlook = null;
oOutlook = new Application();
TaskItem oTask = (TaskItem)oOutlook.CreateItem(OlItemType.olTaskItem);
oTask.Subject = "Testing";
oTask.StartDate = DateTime.Now;
oTask.Display(true);
break;
}
}
For more information :
Microsoft.Office.Interop.Outlook,
Lync SDK 2013

Basic info on how to export BLOB as files

I have researched on how to export BLOBs to image. A DB has an IMAGE column storing several thousand images. I thought of exporting the table but I get a BLOB file error in EMS SQL Manager for InterBase and Firebird.
There have been good posts, but I have still not been able to succeed.
SQL scripts to insert File to BLOB field and export BLOB to File
This example has appeared on numerous pages, including Microsoft's site. I am using INTERBASE (Firebird). I have not found anything related to enabling xp_shell for Firebird, or EMS SQL Manager for InterBase and Firebird (which I have also installed). My guess is: its not possible. I also tried Installing SQL Server Express, SQL Server 2008, and SQL Server 2012. I am at a dead end without having even connected to the server. The reason being I have not managed to start the server. Followed the guide at technet.microsoft: How to: Start SQL Server Agent but there are no services on the right pane to me.
PHP file to download entire column (may not post link due to rep limitation).
It has a MySQL connect section that daunts me. There on my computer is the DB as a GDB file, I also have XAMPP. I can figure out a way to use this as a localhost environment. I hope this is making sense.
Last solution is to use bcp, an idea posted on Stack Overflow titled: fastest way to export blobs from table into individual files. I read the documentation, installed it, but cannot connect to server. I use -S PC-PC -U xxx -P xxx (The server must be wrong) But the information I find all uses -T (Windows Authentication)
Summing up. I am using Firebird, as EMS SQL Manager. I try to extract all images from images table into individual files. These tools both have SQL script screens, but it appears to be in conjunction with xp shell. What would you suggest? Am I using the wrong SQL manager to accomplish this?
There are several ways:
Use isql command BLOBDUMP to write a blob to file,
Use a client library (eg Jaybird for Java, Firebird .net provider for C#) to retrieve the data,
With PHP you can use ibase_blob_get in a loop to get bytes from the blob, and write those to a file.
I don't use nor know EMS SQL Manager, so I don't know if (and how) you can export a blob with that.
The example you link to, and almost all tools you mention are for Microsoft SQL Server, not for Firebird; so it is no wonder those don't work.
Example in Java
A basic example to save blobs to disk using Java 8 (might also work on Java 7) would be:
/**
* Example to save images to disk from a Firebird database.
* <p>
* Code assumes a table with the following structure:
* <pre>
* CREATE TABLE imagestorage (
* filename VARCHAR(255),
* filedata BLOB SUB_TYPE BINARY
* );
* </pre>
* </p>
*/
public class StoreImages {
// Replace testdatabase with alias or path of database
private static final String URL = "jdbc:firebirdsql://localhost/testdatabase?charSet=utf-8";
private static final String USER = "sysdba";
private static final String PASSWORD = "masterkey";
private static final String DEFAULT_FOLDER = "D:\\Temp\\target";
private final Path targetFolder;
public StoreImages(String targetFolder) {
this.targetFolder = Paths.get(targetFolder);
}
public static void main(String[] args) throws IOException, SQLException {
final String targetFolder = args.length == 0 ? DEFAULT_FOLDER : args[0];
final StoreImages storeImages = new StoreImages(targetFolder);
storeImages.store();
}
private void store() throws IOException, SQLException {
if (!Files.isDirectory(targetFolder)) {
throw new FileNotFoundException(String.format("The folder %s does not exist", targetFolder));
}
try (
Connection connection = DriverManager.getConnection(URL, USER, PASSWORD);
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT filename, filedata FROM imagestorage")
) {
while (rs.next()) {
final Path targetFile = targetFolder.resolve(rs.getString("FILENAME"));
if (Files.exists(targetFile)) {
System.out.printf("File %s already exists%n", targetFile);
continue;
}
try (InputStream data = rs.getBinaryStream("FILEDATA")) {
Files.copy(data, targetFile);
}
}
}
}
}
Example in C#
Below is an example in C#, it is similar to the code above.
class StoreImages
{
private const string DEFAULT_FOLDER = #"D:\Temp\target";
private const string DATABASE = #"D:\Data\db\fb3\fb3testdatabase.fdb";
private const string USER = "sysdba";
private const string PASSWORD = "masterkey";
private readonly string targetFolder;
private readonly string connectionString;
public StoreImages(string targetFolder)
{
this.targetFolder = targetFolder;
connectionString = new FbConnectionStringBuilder
{
Database = DATABASE,
UserID = USER,
Password = PASSWORD
}.ToString();
}
static void Main(string[] args)
{
string targetFolder = args.Length == 0 ? DEFAULT_FOLDER : args[0];
var storeImages = new StoreImages(targetFolder);
storeImages.store();
}
private void store()
{
if (!Directory.Exists(targetFolder))
{
throw new FileNotFoundException(string.Format("The folder {0} does not exist", targetFolder), targetFolder);
}
using (var connection = new FbConnection(connectionString))
{
connection.Open();
using (var command = new FbCommand("SELECT filename, filedata FROM imagestorage", connection))
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
string targetFile = Path.Combine(targetFolder, reader["FILENAME"].ToString());
if (File.Exists(targetFile))
{
Console.WriteLine("File {0} already exists", targetFile);
continue;
}
using (var fs = new FileStream(targetFile, FileMode.Create))
{
byte[] filedata = (byte[]) reader["FILEDATA"];
fs.Write(filedata, 0, filedata.Length);
}
}
}
}
}
}

How to create customize destination(with my own server name, client, username, ect) using JCo3 on Netweaver?

Since Netweaver ship with its own DestinationDataProvider, we can't register our own customized destination data provider. Does means we have to use the Netweaver's destination manager to define a destination and use it in our application? Is there a way to connect to any SAP server and create our own destination without using the Netweaver's destination manager?
The way this is done in JCO 3 is slightly different. The idea is create Properties & place from where it can be retrieved (flat file, ldap etc) and then retrieve the same when you want to connect to a sap server.
// So you First use the following code to create the connection parameters
static String DESTINATION_NAME1 = "ABAP_AS_WITHOUT_POOL";
static String DESTINATION_NAME2 = "ABAP_AS_WITH_POOL";
static
{
Properties connectProperties = new Properties();
connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "sap.dsc.com");
connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "76");
connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "800");
connectProperties.setProperty(DestinationDataProvider.JCO_USER, "dsc007");
connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "passwd");
connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "en");
createDestinationDataFile(DESTINATION_NAME1, connectProperties);
connectProperties.setProperty(DestinationDataProvider.JCO_POOL_CAPACITY, "3");
connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT, "10");
createDestinationDataFile(DESTINATION_NAME2, connectProperties);
}
static void createDestinationDataFile(String destinationName, Properties connectProperties)
{
File destCfg = new File(destinationName+".jcoDestination");
try
{
FileOutputStream fos = new FileOutputStream(destCfg, false);
connectProperties.store(fos, "for tests only !");
fos.close();
}
catch (Exception e)
{
throw new RuntimeException("Unable to create the destination files", e);
}
}
// The following code snippet can then be used elsewhere to connect to the sap server
static String DESTINATION_NAME1 = "ABAP_AS_WITHOUT_POOL";
static String DESTINATION_NAME2 = "ABAP_AS_WITH_POOL";
public static void step1Connect() throws JCoException
{
JCoDestination destination = JCoDestinationManager.getDestination(DESTINATION_NAME1);
System.out.println("Attributes:");
System.out.println(destination.getAttributes());
System.out.println();
}
You have to use NetWeaver's Destination Service. Either create the RFC destinations via the NetWeaver Admin UI or programmatically via the offered APIs for managing the destination configurations.
Nevertheless, you can also create JCoCustomDestination instances based on the JCoDestination instances retrieved from the JCoDestinationManager.

SharePoint 2010 Sequential Workflow associated with Content Type Retention policy

Hi: I've built a simple sequential workflow that is triggered by the retention policy used by a content type. The workflow takes the metadata of the current item and copies it to a purge log list located on a different site collection.
Having a hard time debugging this because of the retention policy relies on two timer jobs: information management and expiration policy. Attach the degugger to the w3wp and owetimer process but does not reliably catch the activated workflow.
My workflow history list for each file shows the workflow completed successfully. The meat of the workflow is a codeactivity that collects the data from the current item and updates a central list. That list is showing zero items after the process completes. Is it the code located in the codeactivity?
I removed all of the exception handling to simplify what's being shown.
Code
public Workflow1()
{
InitializeComponent();
}
public Guid workflowId = default(System.Guid);
public SPWorkflowActivationProperties workflowProperties = new SPWorkflowActivationProperties();
string purgeLogListPath = #"http://shptserver/sites/sp";
string listPath = #"http://shptserver/sites/sp/Lists/PurgeLog/AllItems.aspx";
private void onWorkflowActivated1_Invoked(object sender, ExternalDataEventArgs e)
{
}
private void codeActivity1_ExecuteCode(object sender, EventArgs e)
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(purgeLogListPath))
{
try
{
SPWeb web = site.OpenWeb("/");
SPList list = web.GetListFromUrl(listPath);
DateTime today = DateTime.Now;
SPListItem item = list.Items.Add();
item["Title"] = onWorkflowActivated1.WorkflowProperties.Item.DisplayName;
item["Encoded Absolute URL"] = onWorkflowActivated1.WorkflowProperties.ItemUrl;
item["Content Type"] = onWorkflowActivated1.WorkflowProperties.Item.ContentType.Name;
item["Date Purged"] = today.ToString("MMMM dd yyyy");
item["DateTime Purged"] = today.ToString("MMMM dd yyyy hh:mm:ss");
item.Update();
}
catch (Exception ex)
{
string errorEntry = ex.Message;
}
}
});
}
}
Don't really see what you question is, but for the debugging troubles try doing it like this:
1) After you deploy you should restart the Timer Service
2) Via the Central Admin you can go to Timer Jobs and choose 'Run now' to trigger the job and start debugging

SharePoint 2010 Rename Document on Upload Fails in Explorer View

I'm trying to implement a customization in SharePoint 2010 so that when a document is uploaded to a library, the file name is changed to include the Document ID in the name. (I know that people shouldn't worry about file names as much any more, but we have a lot of legacy files already named and users who like to have local copies).
I was able to implement a custom Event Receiver on the ItemAdded event that renames the file by adding the Document ID before the file name. This works correctly from the web Upload.
The problem is with the Explorer View. When I try to add the file using WebDAV in the Explorer View, I get two copies of the file. It seems that when a file is uploaded via the Web the events that fire are
ItemAdding
ItemAdded
But when I copy/paste a file into Explorer View I see the following events:
ItemAdding
ItemAdded
ItemAdding
ItemAdded
ItemUpdating
ItemUpdated
The result is I have two files with different names (since the Document IDs are different).
I've found a lot of people talking about this issue online (this is the best article I found). Anyone have any other ideas? Would it make more sense to do this in a workflow instead of an event receiver? I could use a scheduled job instead, but that might be confusing to the user if the document name changed a few minutes later.
This is my code that works great when using the Web upload but not when using Explorer View:
public override void ItemAdded(SPItemEventProperties properties)
{
try
{
SPListItem currentItem = properties.ListItem;
if (currentItem["_dlc_DocId"] != null)
{
string docId = currentItem["_dlc_DocId"].ToString();
if (!currentItem["BaseName"].ToString().StartsWith(docId))
{
EventFiringEnabled = false;
currentItem["BaseName"] = docId + currentItem["BaseName"];
currentItem.SystemUpdate();
EventFiringEnabled = true;
}
}
}
catch (Exception ex)
{
//Probably should log an error here
}
base.ItemAdded(properties);
}
I have found that using a Visual Studio workflow allows me the most flexibility to do this. A SharePoint Designer Workflow would be simpler, but would be harder to deploy to different sites and libraries.
After reading some good articles including this and this I have come up with this code which seems to work. It starts a workflow and waits until the document is not in a LockState and then processes the filename.
The workflow looks like this:
And here is the code behind:
namespace ControlledDocuments.RenameWorkflow
{
public sealed partial class RenameWorkflow : SequentialWorkflowActivity
{
public RenameWorkflow()
{
InitializeComponent();
}
public Guid workflowId = default(System.Guid);
public SPWorkflowActivationProperties workflowProperties = new SPWorkflowActivationProperties();
Boolean continueWaiting = true;
private void onWorkflowActivated1_Invoked(object sender, ExternalDataEventArgs e)
{
CheckFileStatus();
}
private void whileActivity(object sender, ConditionalEventArgs e)
{
e.Result = continueWaiting;
}
private void onWorkflowItemChanged(object sender, ExternalDataEventArgs e)
{
CheckFileStatus();
}
private void CheckFileStatus()
{
if (workflowProperties.Item.File.LockType == SPFile.SPLockType.None)
{
continueWaiting = false;
}
}
private void renameFile(object sender, EventArgs e)
{
try
{
SPListItem currentItem = workflowProperties.Item;
if (currentItem["_dlc_DocId"] != null)
{
string docId = currentItem["_dlc_DocId"].ToString();
if (!currentItem["BaseName"].ToString().StartsWith(docId))
{
currentItem["BaseName"] = docId + currentItem["BaseName"];
currentItem.SystemUpdate();
}
}
}
catch (Exception ex)
{
//Should do something useful here
}
}
}
}
Hope this helps someone else if they have the same problem.
Well i'd go for the workflow workaround... there are 2 options imo:
1) Create a boolean fied in your document library, then create a SPD workflow that fires when the item is added and set that field to "Changed" or something. In the EventReceiver you then check whether that field has been set..
2) Do everything with the SPD workflow - changing the title like in this example should be no problem.