here function to create crmService based organization Name.
public static MetadataService GetMetadataService(string organizationName) {
MetadataService metadata = new MetadataService();
metadata.Url = "http://localhost:5555/MSCRMServices/2007/CrmService.asmx";
MetadataServiceSdk.CrmAuthenticationToken token = new MetadataServiceSdk.CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = organizationName;
metadata.CrmAuthenticationTokenValue = token;
metadata.Credentials =CredentialCache.DefaultCredentials;
return metadata;
}
Enjoy,
Rami heleg