Exemple #1
0
 public static void CheckInAndPublishFile(SPFile homePageFile, string message, SPCheckinType checkinType)
 {
     try
     {
         homePageFile.CheckIn(message, checkinType);
     }
     catch (Exception ee)
     {
         EssnLog.logInfo("Error on homePageFile.CheckIn in CheckInAndPublishFile in FeatureActivated.");
         EssnLog.logExc(ee);
     }
     try
     {
         homePageFile.Publish(message);
     }
     catch (Exception ee)
     {
         EssnLog.logInfo("Error on homePageFile.Publish in CheckInAndPublishFile in FeatureActivated.");
         EssnLog.logExc(ee);
     }
 }
        private static void CheckInFileByUser(SPFile file, string checkinComment, SPCheckinType checkinType, SPUser modifiedByUser)
        {
            MethodInfo mi = typeof(SPFile).GetMethod(
                "CheckIn",
                BindingFlags.Instance | BindingFlags.NonPublic,
                null,
                new Type[] { typeof(string), typeof(SPCheckinType), typeof(bool), typeof(SPUser) },
                null);

            try
            {
                mi.Invoke(
                    file,
                    new object[] { checkinComment, checkinType, false, modifiedByUser }
                );
            }
            catch (TargetInvocationException invokeEx)
            {
                throw invokeEx.InnerException;
            }
        }