-
-
Posts recentes
Comentários
Arquivos
- setembro 2023
- junho 2023
- janeiro 2023
- agosto 2022
- julho 2022
- dezembro 2021
- março 2021
- fevereiro 2021
- outubro 2020
- agosto 2020
- julho 2020
- junho 2020
- maio 2020
- março 2020
- fevereiro 2020
- agosto 2019
- janeiro 2019
- dezembro 2018
- novembro 2018
- setembro 2018
- junho 2018
- dezembro 2017
- setembro 2017
- agosto 2017
- maio 2017
- abril 2017
- dezembro 2016
- novembro 2016
- julho 2016
- agosto 2015
- julho 2015
- março 2015
- janeiro 2015
- julho 2014
- junho 2014
- maio 2014
- abril 2014
- dezembro 2013
- setembro 2013
- janeiro 2013
- dezembro 2012
- agosto 2012
- julho 2012
- junho 2012
- maio 2012
- abril 2012
- março 2012
- fevereiro 2012
Categorias
Tag Archives: C#
C# Obter todos os usuários AD
Abaixo o código para obter todos os usuários do Active Directory (AD) do windows. Além de printar na tela ele insere em um arquivo texto. public void ObterUsuarioAD() { DirectoryEntry entry = new DirectoryEntry(“LDAP://SERVIDOR-AD”); DirectorySearcher dSearch = new DirectorySearcher(entry); dSearch.PageSize = 10000; dSearch.SizeLimit = 10000; dSearch.Filter = “(&(objectClass=user))”; // get all entries from the active […]
<span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> .NET
<span class="entry-utility-prep entry-utility-prep-tag-links">Tagged</span> C#
Leave a comment
C# – Pegar todos usuarios cadastrado no AD
Em uma necessidade que tive de obter todos os usuários do AD, fiz algumas pesquisas no GOOGLE e encontrei uma boa referência e um código fácil de entender. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.DirectoryServices; using System.DirectoryServices.AccountManagement; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string groupName = […]
<span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> .NET
<span class="entry-utility-prep entry-utility-prep-tag-links">Tagged</span> .NET, C#
Leave a comment
C# – Criar e escrever em um arquivo txt
Vamos escolher onde criar o arquivo e qual nome daremos a ele. string nomeArquivo = “C:/Temp/Arquivo.txt”; Se o arquivo não existir criamos o arquivo com o seguinte comando abaixo: if (!System.IO.File.Exists(nomeArquivo)){ System.IO.File.Create(nomeArquivo).Close(); } Com a classe TextWriter escrevemos no arquivo. System.IO.TextWriter arquivo = System.IO.File.AppendText(nomeArquivo); arquivo.WriteLine(“Teste de escrita no arquivo”); Fechamos o arquivo: arquivo.Close(); Até a […]
<span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> .NET
<span class="entry-utility-prep entry-utility-prep-tag-links">Tagged</span> .NET, C#
Leave a comment
Como Verificar o tipo do objeto em C#
Este é um POST um tanto simples, mas não tão trivial para os programadores. Melhor dizendo e se você recebe um objeto o qual você não sabe o tipo? Ou se você estiver consumindo um serviço (WebService, WCF, etc…), mas e tiver em sua especificação que o tipo do objeto pode ser mudado? Pois bem, […]
<span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> .NET
<span class="entry-utility-prep entry-utility-prep-tag-links">Tagged</span> .NET, C#
Leave a comment
Classe para exportar GridView para Excel
Essa semana tive que exportar os dados de uma GridView para uma planilha Excel, bom… sabia que não era algo muito complicado, mas também nunca tinha feito, sendo assim realizei uma busca no grande mestre Google e encontrei uma classe que me atendeu muito bem. Fácil e descomplicado. using using System; using System.Data; using System.Configuration; using System.IO; […]
<span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> .NET
<span class="entry-utility-prep entry-utility-prep-tag-links">Tagged</span> .NET, C#
Leave a comment