<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How do I connect to Splunk using C# SDK? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-do-I-connect-to-Splunk-using-C-SDK/m-p/131345#M1867</link>
    <description>&lt;P&gt;Well, basicly it sounds like you in general need to sharp your c# &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;
I hope you are using visual studio.&lt;/P&gt;

&lt;P&gt;But i'll do all i can.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;using Splunk;//&amp;lt;-- this is on top of all your program

/// &amp;lt;summary&amp;gt;
/// An example program to authenticate to the server 
/// and print the received token.
/// &amp;lt;/summary&amp;gt;
public class Program
{
    public static void Main()
    {
        // Create new ServiceArgs object to store 
        // connection info
        var connectArgs = new ServiceArgs
        {
            Host = "localhost", //&amp;lt;-- here you write ip of your splunk server. If you have it on your local computer then it's 127.0.0.1
            Port = 8089 //&amp;lt;-- if you haven't change it on your splunk server, then it stay as it is.
            Scheme = "https" //&amp;lt;-- it is my guess. But might be "http".
            // See ServiceArgs documentation for full
            // list of properties
        };

        // Create new Service object
        Service service = new Service(connectArgs);

        // Use the Login method to connect
        service.Login("admin", "changeme"); //&amp;lt;-- those are just login/password. Same as you login to your splunk server.

        //if you are using console application, then this might stay as it is. If you are using forms, then i suggest using MessageBox.Show instead of System.Console.WriteLine.
        // Print received token to verify login
        System.Console.WriteLine("Token: ");
        System.Console.WriteLine(" " + service.Token);
        //use code above or below
        MessageBox.Show("My login token is:" + Environment.NewLine + service.Token);// &amp;lt;-- like this.
    }
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If there will pop up window with strange numbers and letters, then you are logged in. What you want to do with it is up to you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Good luck!&lt;/P&gt;

&lt;P&gt;Cheers!&lt;/P&gt;</description>
    <pubDate>Mon, 24 Aug 2015 20:15:14 GMT</pubDate>
    <dc:creator>szymon_cwieka</dc:creator>
    <dc:date>2015-08-24T20:15:14Z</dc:date>
    <item>
      <title>How do I connect to Splunk using C# SDK?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-I-connect-to-Splunk-using-C-SDK/m-p/131344#M1866</link>
      <description>&lt;P&gt;I went to this link &lt;A href="http://dev.splunk.com/view/csharp-sdk/SP-CAAAEQE"&gt;http://dev.splunk.com/view/csharp-sdk/SP-CAAAEQE&lt;/A&gt; &lt;BR /&gt;
and I need help with each step. I do not know how to create an instance of the service args class. I don't know where to write all of this. Which file do I use?&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2015 16:55:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-I-connect-to-Splunk-using-C-SDK/m-p/131344#M1866</guid>
      <dc:creator>japeter89</dc:creator>
      <dc:date>2015-04-08T16:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I connect to Splunk using C# SDK?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-I-connect-to-Splunk-using-C-SDK/m-p/131345#M1867</link>
      <description>&lt;P&gt;Well, basicly it sounds like you in general need to sharp your c# &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;
I hope you are using visual studio.&lt;/P&gt;

&lt;P&gt;But i'll do all i can.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;using Splunk;//&amp;lt;-- this is on top of all your program

/// &amp;lt;summary&amp;gt;
/// An example program to authenticate to the server 
/// and print the received token.
/// &amp;lt;/summary&amp;gt;
public class Program
{
    public static void Main()
    {
        // Create new ServiceArgs object to store 
        // connection info
        var connectArgs = new ServiceArgs
        {
            Host = "localhost", //&amp;lt;-- here you write ip of your splunk server. If you have it on your local computer then it's 127.0.0.1
            Port = 8089 //&amp;lt;-- if you haven't change it on your splunk server, then it stay as it is.
            Scheme = "https" //&amp;lt;-- it is my guess. But might be "http".
            // See ServiceArgs documentation for full
            // list of properties
        };

        // Create new Service object
        Service service = new Service(connectArgs);

        // Use the Login method to connect
        service.Login("admin", "changeme"); //&amp;lt;-- those are just login/password. Same as you login to your splunk server.

        //if you are using console application, then this might stay as it is. If you are using forms, then i suggest using MessageBox.Show instead of System.Console.WriteLine.
        // Print received token to verify login
        System.Console.WriteLine("Token: ");
        System.Console.WriteLine(" " + service.Token);
        //use code above or below
        MessageBox.Show("My login token is:" + Environment.NewLine + service.Token);// &amp;lt;-- like this.
    }
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If there will pop up window with strange numbers and letters, then you are logged in. What you want to do with it is up to you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Good luck!&lt;/P&gt;

&lt;P&gt;Cheers!&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2015 20:15:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-I-connect-to-Splunk-using-C-SDK/m-p/131345#M1867</guid>
      <dc:creator>szymon_cwieka</dc:creator>
      <dc:date>2015-08-24T20:15:14Z</dc:date>
    </item>
  </channel>
</rss>

