Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8178093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:40:55+00:00 2026-06-06T23:40:55+00:00

I have a custom app which uses the crmservice.asmx to retrieve contacts from dynamics

  • 0

I have a custom app which uses the crmservice.asmx to retrieve contacts from dynamics crm 4.

The problem: I search for the contact in my custom app and don’t find it. I go to MSCRM and create the contact. When I then try to search again in my custom app, I still can’t find the contact.

It has to be cache for the crmservice.asmx because when I try 10 minutes later, the contact is found in my custom app.

But how do I manage the cache settings on the crmservice.asmx?

My code for instantiating

Private Const CRMServiceUrl As String = "https://*****/mscrmservices/2007/crmservice.asmx"
Private Const MetadataServiceUrl As String = "https://*****/MSCRMServices/2007/MetadataService.asmx"
Private Const OrganizationName As String = "****"
Private Const Username As String = "****"
Private Const Password As String = "****"
Private Const Domain As String = "****"

Private ReadOnly _service As CrmService.CrmService
Private ReadOnly _metadataService As MetadataService.MetadataService


Public Sub New()
    Dim crmServiceToken As New CrmAuthenticationToken()
    crmServiceToken.AuthenticationType = Microsoft.Crm.Sdk.AuthenticationType.AD
    crmServiceToken.OrganizationName = OrganizationName

    Dim metadataServiceToken As New MetadataService.CrmAuthenticationToken()
    metadataServiceToken.AuthenticationType = Microsoft.Crm.Sdk.AuthenticationType.AD
    metadataServiceToken.OrganizationName = OrganizationName

    Dim credentials As ICredentials = New NetworkCredential(Username, Password, Domain)

    _service = New CrmService.CrmService()
    _service.Url = CRMServiceUrl
    _service.CrmAuthenticationTokenValue = crmServiceToken
    _service.Credentials = credentials

    _metadataService = New MetadataService.MetadataService()
    _metadataService.Url = MetadataServiceUrl
    _metadataService.CrmAuthenticationTokenValue = metadataServiceToken
    _metadataService.Credentials = credentials
End Sub

and the method that gets contacts

Public Function GetContact(ByVal request As GetContactRequest) As contact Implements ICRM.GetContact
    Dim query As New QueryExpression()
    query.EntityName = EntityName.contact.ToString()
    query.ColumnSet = New AllColumns()

    Dim condition As ConditionExpression
    Dim expr As New List(Of ConditionExpression)

    condition = New ConditionExpression()
    condition.AttributeName = "statecode"
    condition.[Operator] = ConditionOperator.Equal
    condition.Values = New Object() {0}
    expr.Add(condition)

    If request.ContactId <> Guid.Empty Then
        condition = New ConditionExpression()
        condition.AttributeName = "contactid"
        condition.[Operator] = ConditionOperator.Equal
        condition.Values = New String() {request.ContactId.ToString}
        expr.Add(condition)
    End If
    If Not String.IsNullOrEmpty(request.CustomerCode) Then
        condition = New ConditionExpression()
        condition.AttributeName = "new_orgcustomerno"
        condition.[Operator] = ConditionOperator.Like
        condition.Values = New String() {request.CustomerCode + "%"}
        expr.Add(condition)
    End If

    If Not String.IsNullOrEmpty(request.ContactSeq) Then
        condition = New ConditionExpression()
        condition.AttributeName = "new_contact_seq"
        condition.[Operator] = ConditionOperator.Like
        condition.Values = New String() {request.ContactSeq + "%"}
        expr.Add(condition)
    End If


    Dim filter As New FilterExpression()
    filter.FilterOperator = LogicalOperator.[And]
    filter.Conditions = expr.ToArray

    query.Criteria = filter
    Dim contacts As BusinessEntityCollection = _service.RetrieveMultiple(query)

    If contacts.BusinessEntities.Length > 0 Then
        Dim a As contact = DirectCast(contacts.BusinessEntities(0), contact)
        Return a
    Else
        Return Nothing
    End If
End Function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:40:55+00:00Added an answer on June 6, 2026 at 11:40 pm

    solved: by using Retrieve() instead of RetrieveMultiple() I get the contact at once.

    this means that by searching for the newly created contact by other columns, I can’t access it at once (have to wait a couple of minutes). I have to use the contactid.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed an app which uses my own custom keyboard (well, a view
I have a custom dialog in my app that descends from Activity and uses
I have a custom FMS app and Flash Player broadcaster which uses bandwidth detection
I have a custom validator (located in app/validators/uri_validator.rb) which is used in: validates :link,
I have a custom view in my Android App that uses a ScaleGestureDetector.SimpleOnScaleGestureListener to
I have a custom view (inherited from UIView ) in my app. The custom
I have started creating an app which uses a core data stack at the
I have a winforms app that uses a strongly typed custom DataSet for holding
I have an app which uses a Listview to display Lectures. The Lectures are
Let's say I have and custom STS which authenticates users of a web app.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.