Skip to content

Instantly share code, notes, and snippets.

@fraga
fraga / gist:1068426
Created July 6, 2011 21:47
How to connect to microsoft exchange online and retrieve info
public class ExchangePowerShell
{
public static PSCredential GetCredentials(string userName, string password)
{
var securePassword = new SecureString();
Array.ForEach(password.ToCharArray(), securePassword.AppendChar);
var cred = new PSCredential(userName, securePassword);
return cred;
}
@fraga
fraga / gist:1072137
Created July 8, 2011 15:58
app.config file for .net 4.0 and activating legacy v2 policy
<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">"<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
@fraga
fraga / gist:1072951
Created July 8, 2011 22:12
how to connect to microsoft dynamics ax 2012 WCF Currency services using a create request
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CurrencyServiceExample.DAX.Services;
namespace CurrencyServiceExample
{
class Program
@fraga
fraga / gist:1078228
Created July 12, 2011 15:40
Updating userinfo database information AX 2012 after restoring contoso
update userinfo
set
networkdomain = 'YourDomain',
networkalias = 'YourAlias',
SID = 'YourSID'
where ID = 'Admin'
@fraga
fraga / gist:1078411
Created July 12, 2011 16:55
C# console command line utility to get user SID AX 2012
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.DirectoryServices;
namespace GetUserSID
{
/// <summary>
/// This class must work on a username and domainname, access active directory services
@fraga
fraga / gist:1187727
Created September 2, 2011 01:15
How to create an item using ItemServices and EcoResProductServices in AX 2012
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.ServiceModel.Description;
using System.Text;
using Tutorial.AIF.CreateItem.EcoResProductServices;
using Tutorial.AIF.CreateItem.InventItemServices;
namespace Tutorial.AIF.CreateItem
@fraga
fraga / EnableRemoteErrors.rss
Created September 8, 2011 03:16
Enabling remote errors in SRSS
1) Put this code in a file called EnableRemoteErrors.rss
Public Sub Main()
Dim P As New [Property]()
P.Name = "EnableRemoteErrors"
P.Value = True
Dim Properties(0) As [Property]
Properties(0) = P
Try
rs.SetSystemProperties(Properties)
@fraga
fraga / InstallGetPsPoshGit
Created January 3, 2012 22:26
Installing GetPs and Posh-Git
(new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1") | iex
Install-Module Posh-Git –force
@fraga
fraga / gist:1566674
Created January 5, 2012 19:03
Setting up xUnit in VS as external tool
Go to Tools -> External Tools -> Add
Command: Your xunit.console.exe file path
Arguments: $(BinDir)$(TargetName)$(TargetExt)
Initial Directory: $(BinDir)
Change xunit.console.config so that you have requiredRuntime if you want to run .NET 4.0
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
@fraga
fraga / instagram.cs
Created November 19, 2012 04:10
Get all images from instagram (api v1)
do
{
if (webRequest == null && string.IsNullOrEmpty(nextPageUrl))
webRequest = HttpWebRequest.Create(String.Format("https://api.instagram.com/v1/tags/{0}/media/recent?client_id={1}", tagName, clientId));
else
webRequest = HttpWebRequest.Create(nextPageUrl);
var responseStream = webRequest.GetResponse().GetResponseStream();
Encoding encode = System.Text.Encoding.Default;