Monday, 27 January 2025

Microsoft 365 URLs and IP address ranges

 To whitelist IP addresses or URLs on the server for Microsoft applications.


Microsoft 365 URLs and IP address ranges - Microsoft 365 Enterprise | Microsoft Learn

Convert Managed Solution to UnManaged Solutions

  1. Run the Below SQL Script

  • DECLARE @solutionId       UNIQUEIDENTIFIER,
            @systemSolutionId UNIQUEIDENTIFIER -- specify the uniquename of the managed solution you'd like to unmanage here it is StagingOrg

    SELECT @solutionId = solutionid
    FROM   solutionbase
    WHERE  uniquename = 'Your solution name' -- DO NOT TOUCH FROM HERE ON --

    SELECT @systemSolutionId = solutionid
    FROM   solutionbase
    WHERE  uniquename = 'Active'

    UPDATE publisherbase
    SET    isreadonly = 0
    WHERE  publisherid IN (SELECT publisherid
                           FROM   solutionbase
                           WHERE  solutionid = @solutionId)

    PRINT 'updated publisher'

    DECLARE @tables TABLE
      (
         id         INT IDENTITY,
         NAME       NVARCHAR(100),
         ismanaged  BIT,
         issolution BIT
      )
    DECLARE @count        INT,
            @currentTable NVARCHAR(100),
            @currentM     BIT,
            @currentS     BIT,
            @sql          NVARCHAR(max) -- go through all the tables that have the ismanaged/solutionid flag, find the related records for the current solution and move them to the crm active solution.

    INSERT INTO @tables
                (NAME,
                 ismanaged,
                 issolution)
    SELECT NAME,
           1,
           0
    FROM   sysobjects
    WHERE  id IN (SELECT id
                  FROM   syscolumns
                  WHERE  NAME IN ( 'IsManaged' ))
           AND type = 'U'
    ORDER  BY NAME

    INSERT INTO @tables
                (NAME,
                 ismanaged,
                 issolution)
    SELECT NAME,
           0,
           1
    FROM   sysobjects
    WHERE  id IN (SELECT id
                  FROM   syscolumns
                  WHERE  NAME IN ( 'SolutionId' ))
           AND type = 'U'
           AND NAME NOT IN ( 'SolutionComponentBase' )
           AND NAME NOT LIKE '%ribbon%' -- ignore this table because it doesn't make a difference. it does cause dependency errors on the exported solution but we can manually edit the xml for that. order by name

    SELECT @count = Count(*)
    FROM   @tables

    WHILE ( @count > 0 )
      BEGIN
          SELECT @currentTable = NAME,
                 @currentM = ismanaged,
                 @currentS = issolution
          FROM   @tables
          WHERE  id = @count

          IF ( @currentM = 1 )
            BEGIN
                SELECT @sql = 'update ' + @currentTable
                              + ' set IsManaged=0 where SolutionId=N'''
                              + Cast( @solutionId AS NVARCHAR(100) ) + ''''

                EXEC (@sql)

                PRINT 'updated IsManaged to 0 on: '
                      + @currentTable
            END

          IF ( @currentS = 1 )
            BEGIN
                SELECT @sql = 'update ' + @currentTable
                              + ' set SolutionId=N'''
                              + Cast( @systemSolutionId AS NVARCHAR(100) )
                              + ''' where SolutionId=N'''
                              + Cast( @solutionId AS NVARCHAR(100) ) + ''''

                EXEC (@sql)

                PRINT 'updated SolutionId on: ' + @currentTable
            END

          SELECT @count = @count - 1,
                 @currentTable = NULL
      END 


    1. Go to Settings > Customizations > Solutions

    2. Export the Solution as Unmanaged

    3. Save and Extract the Solution File

    4. Open and Edit the solution.xml File

    5. Change the <Managed> Tag
      Find the <Managed> tag within the solution.xml file, Change the value from 1 (Managed) to 0 (Unmanaged):

    6. Remove All MissingDependency Elements
      Scroll down towards the bottom of the solution.xml file, Remove all <MissingDependency> elements or self-close them like this:

    7. Re-Zip the Content

    8. Import the Solution Back into CRM