web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

i'm getting the error-"Additional information: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail." when i try to retive info from an entity using console ap

(0) ShareShare
ReportReport
Posted on by 85

An unhandled exception of type 'System.ServiceModel.Security.MessageSecurityException' occurred in Microsoft.Xrm.Sdk.dll

Additional information: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.

my code:

using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Client;
using Microsoft.Xrm.Sdk.Query;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.ServiceModel.Description;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplicationdate
{
class Program
{
static void Main(string[] args)
{
#region Org Connection
IOrganizationService organizationService = null;
ClientCredentials clientCredentials = new ClientCredentials();
//clientCredentials.UserName.UserName = ConfigurationManager.AppSettings["Username"].ToString();
//clientCredentials.UserName.Password = ConfigurationManager.AppSettings["Password"].ToString();

clientCredentials.UserName.UserName = "trail.onmicrosoft.com";
clientCredentials.UserName.Password = "password";
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;



// Copy and Paste Organization Service Endpoint Address URL
organizationService = new OrganizationServiceProxy(new Uri("org------.api.crm8.dynamics.com/.../Organization.svc"), null, clientCredentials, null);
#endregion

if (organizationService != null)
{
Console.WriteLine("sucess");
var query = new QueryExpression("crf1b_class")
{
ColumnSet = new ColumnSet("crf1b_name"),
Criteria = new FilterExpression(LogicalOperator.And),
TopCount = 50
};
//query.Criteria.AddCondition("address1_city", ConditionOperator.Equal, "Redmond");
//query.AddOrder("name", OrderType.Ascending);

EntityCollection results = organizationService.RetrieveMultiple(query);

results.Entities.ToList().ForEach(x =>
{
Console.WriteLine(x.Attributes["crf1b_name"]);
});
Console.ReadLine();
}


}
}
}

I have the same question (0)
  • Manoj Profile Picture
    85 on at

    is there any one to help me here?

    this is the line where i'm getting error

    organizationService.RetrieveMultiple(query);

  • Suggested answer
    meelamri Profile Picture
    13,218 User Group Leader on at

    Hello Manoj,

    I think you're using multi-factor authentication. If yes, disable it, and test your console application again.

    softchief.com/.../

  • meelamri Profile Picture
    13,218 User Group Leader on at

    Please, edit your initial post and delete your sensitive data such as your username and password

  • Suggested answer
    meelamri Profile Picture
    13,218 User Group Leader on at

    Hello,

    Did you disable multi-factor authentication and test your console application?

  • Manoj Profile Picture
    85 on at

    No i don't know anything about Azure, how to connect with it.

  • Manoj Profile Picture
    85 on at

    THANK YOU

  • Suggested answer
    meelamri Profile Picture
    13,218 User Group Leader on at

    Check this video: https://youtu.be/uht_7D5FHJ8

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
11manish Profile Picture

11manish 165

#2
ManoVerse Profile Picture

ManoVerse 156 Super User 2026 Season 1

#3
Zhilan Profile Picture

Zhilan 49

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans